6 * This file contains koi8-r decoding function that is needed to read
7 * koi8-r encoded mails in non-koi8-r locale.
9 * Original data taken from:
10 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
12 * Name: KOI8-R (RFC1489) to Unicode
13 * Unicode version: 3.0
15 * Table format: Format A
16 * Date: 18 August 1999
17 * Authors: Helmut Richter <richter@lrz.de>
19 * Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved.
21 * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
22 * No claims are made as to fitness for any particular purpose. No
23 * warranties of any kind are expressed or implied. The recipient
24 * agrees to determine applicability of information provided. If this
25 * file has been provided on optical media by Unicode, Inc., the sole
26 * remedy for any claim will be exchange of defective media within 90
29 * Unicode, Inc. hereby grants the right to freely use the information
30 * supplied in this file in the creation of products supporting the
31 * Unicode Standard, and to make copies of this file in any form for
32 * internal or external distribution as long as this notice remains
35 * @copyright © 2003-2006 The SquirrelMail Project Team
36 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
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);