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-r decoding function that is needed to read
9 * koi8-r encoded mails in non-koi8-r locale.
11 * Original data taken from:
12 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
14 * Name: KOI8-R (RFC1489) to Unicode
15 * Unicode version: 3.0
17 * Table format: Format A
18 * Date: 18 August 1999
19 * Authors: Helmut Richter <richter@lrz.de>
21 * Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved.
23 * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
24 * No claims are made as to fitness for any particular purpose. No
25 * warranties of any kind are expressed or implied. The recipient
26 * agrees to determine applicability of information provided. If this
27 * file has been provided on optical media by Unicode, Inc., the sole
28 * remedy for any claim will be exchange of defective media within 90
31 * Unicode, Inc. hereby grants the right to freely use the information
32 * supplied in this file in the creation of products supporting the
33 * Unicode Standard, and to make copies of this file in any form for
34 * internal or external distribution as long as this notice remains
38 * @package squirrelmail
43 * Decode koi8r strings
44 * @param string $string Encoded string
45 * @return string Decoded string
47 function charset_decode_koi8_r ($string) {
48 // don't do decoding when there are no 8bit symbols
49 if (! sq_is8bit($string,'koi8-r'))
183 $string = str_replace(array_keys($koi8r), array_values($koi8r), $string);