e9a71964 |
1 | <?php |
d6c32258 |
2 | /** |
e9a71964 |
3 | * decode/cp10081.php |
4 | * $Id$ |
5 | * |
6 | * Copyright (c) 2003 The SquirrelMail Project Team |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
9 | * This file contains cp10081 (MacTurkish) decoding function that |
10 | * is needed to read cp10081 encoded mails in non-cp10081 locale. |
11 | * |
12 | * Original data taken from: |
13 | * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/TURKISH.TXT |
14 | * |
15 | * Name: cp10081_MacTurkish to Unicode table |
16 | * Unicode version: 2.0 |
17 | * Table version: 2.00 |
18 | * Table format: Format A |
19 | * Date: 04/24/96 |
20 | * Authors: Lori Brownell <loribr@microsoft.com> |
21 | * K.D. Chang <a-kchang@microsoft.com> |
d6c32258 |
22 | * @package squirrelmail |
23 | * @subpackage decode |
e9a71964 |
24 | */ |
25 | |
d6c32258 |
26 | /** |
27 | * Decode cp10081(MacTurkish) encoded string |
28 | * @param string $string Encoded string |
29 | * @return string $string Decoded string |
30 | */ |
e9a71964 |
31 | function charset_decode_cp10081 ($string) { |
32 | global $default_charset; |
33 | |
34 | if (strtolower($default_charset) == 'x-mac-turkish') |
35 | return $string; |
36 | |
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) ) |
40 | return $string; |
41 | |
42 | $cp10081 = array( |
43 | "\0x80" => 'Ä', |
44 | "\0x81" => 'Å', |
45 | "\0x82" => 'Ç', |
46 | "\0x83" => 'É', |
47 | "\0x84" => 'Ñ', |
48 | "\0x85" => 'Ö', |
49 | "\0x86" => 'Ü', |
50 | "\0x87" => 'á', |
51 | "\0x88" => 'à', |
52 | "\0x89" => 'â', |
53 | "\0x8A" => 'ä', |
54 | "\0x8B" => 'ã', |
55 | "\0x8C" => 'å', |
56 | "\0x8D" => 'ç', |
57 | "\0x8E" => 'é', |
58 | "\0x8F" => 'è', |
59 | "\0x90" => 'ê', |
60 | "\0x91" => 'ë', |
61 | "\0x92" => 'í', |
62 | "\0x93" => 'ì', |
63 | "\0x94" => 'î', |
64 | "\0x95" => 'ï', |
65 | "\0x96" => 'ñ', |
66 | "\0x97" => 'ó', |
67 | "\0x98" => 'ò', |
68 | "\0x99" => 'ô', |
69 | "\0x9A" => 'ö', |
70 | "\0x9B" => 'õ', |
71 | "\0x9C" => 'ú', |
72 | "\0x9D" => 'ù', |
73 | "\0x9E" => 'û', |
74 | "\0x9F" => 'ü', |
75 | "\0xA0" => '†', |
76 | "\0xA1" => '°', |
77 | "\0xA2" => '¢', |
78 | "\0xA3" => '£', |
79 | "\0xA4" => '§', |
80 | "\0xA5" => '•', |
81 | "\0xA6" => '¶', |
82 | "\0xA7" => 'ß', |
83 | "\0xA8" => '®', |
84 | "\0xA9" => '©', |
85 | "\0xAA" => '™', |
86 | "\0xAB" => '´', |
87 | "\0xAC" => '¨', |
88 | "\0xAD" => '≠', |
89 | "\0xAE" => 'Æ', |
90 | "\0xAF" => 'Ø', |
91 | "\0xB0" => '∞', |
92 | "\0xB1" => '±', |
93 | "\0xB2" => '≤', |
94 | "\0xB3" => '≥', |
95 | "\0xB4" => '¥', |
96 | "\0xB5" => 'µ', |
97 | "\0xB6" => '∂', |
98 | "\0xB7" => '∑', |
99 | "\0xB8" => '∏', |
100 | "\0xB9" => 'π', |
101 | "\0xBA" => '∫', |
102 | "\0xBB" => 'ª', |
103 | "\0xBC" => 'º', |
104 | "\0xBD" => 'Ω', |
105 | "\0xBE" => 'æ', |
106 | "\0xBF" => 'ø', |
107 | "\0xC0" => '¿', |
108 | "\0xC1" => '¡', |
109 | "\0xC2" => '¬', |
110 | "\0xC3" => '√', |
111 | "\0xC4" => 'ƒ', |
112 | "\0xC5" => '≈', |
113 | "\0xC6" => '∆', |
114 | "\0xC7" => '«', |
115 | "\0xC8" => '»', |
116 | "\0xC9" => '…', |
117 | "\0xCA" => ' ', |
118 | "\0xCB" => 'À', |
119 | "\0xCC" => 'Ã', |
120 | "\0xCD" => 'Õ', |
121 | "\0xCE" => 'Œ', |
122 | "\0xCF" => 'œ', |
123 | "\0xD0" => '–', |
124 | "\0xD1" => '—', |
125 | "\0xD2" => '“', |
126 | "\0xD3" => '”', |
127 | "\0xD4" => '‘', |
128 | "\0xD5" => '’', |
129 | "\0xD6" => '÷', |
130 | "\0xD7" => '◊', |
131 | "\0xD8" => 'ÿ', |
132 | "\0xD9" => 'Ÿ', |
133 | "\0xDA" => 'Ğ', |
134 | "\0xDB" => 'ğ', |
135 | "\0xDC" => 'İ', |
136 | "\0xDD" => 'ı', |
137 | "\0xDE" => 'Ş', |
138 | "\0xDF" => 'ş', |
139 | "\0xE0" => '‡', |
140 | "\0xE1" => '·', |
141 | "\0xE2" => '‚', |
142 | "\0xE3" => '„', |
143 | "\0xE4" => '‰', |
144 | "\0xE5" => 'Â', |
145 | "\0xE6" => 'Ê', |
146 | "\0xE7" => 'Á', |
147 | "\0xE8" => 'Ë', |
148 | "\0xE9" => 'È', |
149 | "\0xEA" => 'Í', |
150 | "\0xEB" => 'Î', |
151 | "\0xEC" => 'Ï', |
152 | "\0xED" => 'Ì', |
153 | "\0xEE" => 'Ó', |
154 | "\0xEF" => 'Ô', |
155 | "\0xF0" => '', |
156 | "\0xF1" => 'Ò', |
157 | "\0xF2" => 'Ú', |
158 | "\0xF3" => 'Û', |
159 | "\0xF4" => 'Ù', |
160 | "\0xF5" => '', |
161 | "\0xF6" => 'ˆ', |
162 | "\0xF7" => '˜', |
163 | "\0xF8" => '¯', |
164 | "\0xF9" => '˘', |
165 | "\0xFA" => '˙', |
166 | "\0xFB" => '˚', |
167 | "\0xFC" => '¸', |
168 | "\0xFD" => '˝', |
169 | "\0xFE" => '˛', |
170 | "\0xFF" => 'ˇ' |
171 | ); |
172 | |
173 | $string = str_replace(array_keys($cp10081), array_values($cp10081), $string); |
174 | |
175 | return $string; |
176 | } |
d6c32258 |
177 | ?> |