5 * Copyright (c) 2003-2005 The SquirrelMail Project Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 * This file contains koi8-u decoding function that is needed to read
9 * koi8-u encoded mails in non-koi8-u locale.
11 * Original data taken from rfc2319
15 * Copyright (C) The Internet Society (1998). All Rights Reserved.
17 * This document and translations of it may be copied and furnished to
18 * others, and derivative works that comment on or otherwise explain it
19 * or assist in its implementation may be prepared, copied, published
20 * and distributed, in whole or in part, without restriction of any
21 * kind, provided that the above copyright notice and this paragraph are
22 * included on all such copies and derivative works. However, this
23 * document itself may not be modified in any way, such as by removing
24 * the copyright notice or references to the Internet Society or other
25 * Internet organizations, except as needed for the purpose of
26 * developing Internet standards in which case the procedures for
27 * copyrights defined in the Internet Standards process must be
28 * followed, or as required to translate it into languages other than
31 * The limited permissions granted above are perpetual and will not be
32 * revoked by the Internet Society or its successors or assigns.
34 * This document and the information contained herein is provided on an
35 * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
36 * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
37 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
38 * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
39 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
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);