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 cp10029 (MacLatin2) decoding function that
10 * is needed to read cp10029 encoded mails in non-cp10029 locale.
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/LATIN2.TXT
15 * Name: cp10029_MacLatin2 to Unicode table
16 * Unicode version: 2.0
18 * Table format: Format A
20 * Authors: Lori Brownell <loribr@microsoft.com>
21 * K.D. Chang <a-kchang@microsoft.com>
22 * @package squirrelmail
27 * Decode cp10029 (MacLatin2) string
28 * @param string $string Encoded string
29 * @return string $string Decoded string
31 function charset_decode_cp10029 ($string) {
32 global $default_charset;
34 if (strtolower($default_charset) == 'x-mac-centraleurroman')
37 /* Only do the slow convert if there are 8-bit characters */
38 /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
39 if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) )
110 "\0xC3" => '√',
113 "\0xC6" => '∆',
116 "\0xC9" => '…',
123 "\0xD0" => '–',
124 "\0xD1" => '—',
125 "\0xD2" => '“',
126 "\0xD3" => '”',
127 "\0xD4" => '‘',
128 "\0xD5" => '’',
130 "\0xD7" => '◊',
135 "\0xDC" => '‹',
136 "\0xDD" => '›',
141 "\0xE2" => '‚',
142 "\0xE3" => '„',
173 $string = str_replace(array_keys($cp10029), array_values($cp10029), $string);