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 cp866 decoding function that is needed to read
10 * cp866 encoded mails in non-cp866 locale.
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/
15 Name: cp866_DOSCyrillicRussian to Unicode table
18 Table format: Format A
20 Authors: Lori Brownell <loribr@microsoft.com>
21 K.D. Chang <a-kchang@microsoft.com>
22 The entries are in cp866_DOSCyrillicRussian order
26 function charset_decode_cp866 ($string) {
27 global $default_charset;
29 if (strtolower($default_charset) == 'ibm866')
32 /* Only do the slow convert if there are 8-bit characters */
33 /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
34 if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) )
168 $string = str_replace(array_keys($cp866), array_values($cp866), $string);