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 cp10017 (MacUkrainian) decoding function that
10 * is needed to read cp10017 encoded mails in non-cp10017 locale.
12 * Apple states [2] that x-mac-ukrainian differs from x-mac-cyrillic [1]
13 * only in two places. According to [3] these symbols are:
14 * 0x92 - U+1168 - CYRILLIC CAPITAL LETTER GHE WITH UPTURN
15 * 0xD6 - U+1169 - CYRILLIC SMALL LETTER GHE WITH UPTURN
18 * 1. ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/CYRILLIC.TXT
19 * 2. http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html
20 * 3. http://shlimazl.nm.ru/rus/cptable.htm (page in Russian)
23 function charset_decode_cp10017 ($string) {
24 global $default_charset;
26 if (strtolower($default_charset) == 'x-mac-ukrainian')
29 /* Only do the slow convert if there are 8-bit characters */
30 /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
31 if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) )
165 $string = str_replace(array_keys($cp10017), array_values($cp10017), $string);