6 * Copyright (c) 2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This file contains koi8-r decoding function that is needed to read
10 * koi8-r encoded mails in non-koi8-r locale.
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
15 * Name: KOI8-R (RFC1489) to Unicode
16 * Unicode version: 3.0
18 * Table format: Format A
19 * Date: 18 August 1999
20 * Authors: Helmut Richter <richter@lrz.de>
22 * Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved.
24 * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
25 * No claims are made as to fitness for any particular purpose. No
26 * warranties of any kind are expressed or implied. The recipient
27 * agrees to determine applicability of information provided. If this
28 * file has been provided on optical media by Unicode, Inc., the sole
29 * remedy for any claim will be exchange of defective media within 90
32 * Unicode, Inc. hereby grants the right to freely use the information
33 * supplied in this file in the creation of products supporting the
34 * Unicode Standard, and to make copies of this file in any form for
35 * internal or external distribution as long as this notice remains
40 function charset_decode_koi8r ($string) {
41 global $default_charset;
43 if (strtolower($default_charset) == 'koi8-r')
46 /* Only do the slow convert if there are 8-bit characters */
47 /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
48 if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) )
182 $string = str_replace(array_keys($koi8r), array_values($koi8r), $string);