6 * This file contains koi8-u decoding function that is needed to read
7 * koi8-u encoded mails in non-koi8-u locale.
9 * Original data taken from rfc2319
13 * Copyright (C) The Internet Society (1998). All Rights Reserved.
15 * This document and translations of it may be copied and furnished to
16 * others, and derivative works that comment on or otherwise explain it
17 * or assist in its implementation may be prepared, copied, published
18 * and distributed, in whole or in part, without restriction of any
19 * kind, provided that the above copyright notice and this paragraph are
20 * included on all such copies and derivative works. However, this
21 * document itself may not be modified in any way, such as by removing
22 * the copyright notice or references to the Internet Society or other
23 * Internet organizations, except as needed for the purpose of
24 * developing Internet standards in which case the procedures for
25 * copyrights defined in the Internet Standards process must be
26 * followed, or as required to translate it into languages other than
29 * The limited permissions granted above are perpetual and will not be
30 * revoked by the Internet Society or its successors or assigns.
32 * This document and the information contained herein is provided on an
33 * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
34 * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
35 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
36 * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
37 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
39 * @copyright 2003-2024 The SquirrelMail Project Team
40 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
42 * @package squirrelmail
47 * Decode koi8-u encoded strings
48 * @param string $string Encoded string
49 * @return string Decoded string
51 function charset_decode_koi8_u ($string) {
52 // don't do decoding when there are no 8bit symbols
53 if (! sq_is8bit($string,'koi8-u'))
187 $string = str_replace(array_keys($koi8u), array_values($koi8u), $string);