59177427 |
1 | <?php |
1fd97780 |
2 | |
3 | /** |
4 | ** i18n.php |
5 | ** |
6 | ** This file contains variuos functions that are needed to do |
7 | ** internationalization of SquirrelMail. |
8 | ** |
c1d54dc7 |
9 | ** Internally the output character set is used. Other characters are |
10 | ** encoded using Unicode entities according to HTML 4.0. |
173ed887 |
11 | ** |
b8c4285a |
12 | ** $Id$ |
1fd97780 |
13 | **/ |
14 | |
15 | $i18n_php = true; |
16 | |
d30d79f2 |
17 | // This array specifies the available languages. |
e8816411 |
18 | $languages["en"]["NAME"] = "English"; |
cf7be4f2 |
19 | $languages["en"]["CHARSET"] = "iso-8859-1"; |
13e0c649 |
20 | |
21 | $languages["ca"]["NAME"] = "Catalan"; |
22 | $languages["ca"]["CHARSET"] = "iso-8859-1"; |
23 | |
24 | $languages["cs_CZ"]["NAME"] = "Czech"; |
25 | $languages["cs_CZ"]["CHARSET"] = "iso-8859-2"; |
26 | |
27 | $languages["da"]["NAME"] = "Danish"; |
28 | $languages["da"]["CHARSET"] = "iso-8859-1"; |
29 | |
62d9ff4d |
30 | $languages["de"]["NAME"] = "Deutsch"; |
e8816411 |
31 | $languages["de"]["CHARSET"] = "iso-8859-1"; |
13e0c649 |
32 | |
43161dcc |
33 | $languages["nl"]["NAME"] = "Dutch"; |
34 | $languages["nl"]["CHARSET"] = "iso-8859-1"; |
13e0c649 |
35 | |
2a54aa37 |
36 | $languages["fr"]["NAME"] = "French"; |
37 | $languages["fr"]["CHARSET"] = "iso-8859-1"; |
13e0c649 |
38 | |
39 | $languages["fi"]["NAME"] = "Finnish"; |
40 | $languages["fi"]["CHARSET"] = "iso-8859-1"; |
41 | |
4c973296 |
42 | $languages["it"]["NAME"] = "Italian"; |
43 | $languages["it"]["CHARSET"] = "iso-8859-1"; |
13e0c649 |
44 | |
a77ef4c9 |
45 | $languages["ko"]["NAME"] = "Korean"; |
46 | $languages["ko"]["CHARSET"] = "euc-KR"; |
13e0c649 |
47 | |
48 | $languages["no"]["NAME"] = "Norwegian (Bokmål)"; |
49 | $languages["no"]["CHARSET"] = "iso-8859-1"; |
50 | |
51 | $languages["no_NO_ny"]["NAME"] = "Norwegian (Nynorsk)"; |
52 | $languages["no_NO_ny"]["CHARSET"] = "iso-8859-1"; |
53 | |
54 | $languages["pl"]["NAME"] = "Polish"; |
55 | $languages["pl"]["CHARSET"] = "iso-8859-2"; |
56 | |
57 | $languages["pt_BR"]["NAME"] = "Portuguese (Brazil)"; |
58 | $languages["pt_BR"]["CHARSET"] = "iso-8859-1"; |
59 | |
60 | $languages["ru"]["NAME"] = "Russian KOI8-R"; |
61 | $languages["ru"]["CHARSET"] = "koi8-r"; |
62 | |
cf7be4f2 |
63 | $languages["sr"]["NAME"] = "Serbian"; |
64 | $languages["sr"]["CHARSET"] = "iso-8859-2"; |
13e0c649 |
65 | |
66 | $languages["es"]["NAME"] = "Spanish"; |
67 | $languages["es"]["CHARSET"] = "iso-8859-1"; |
68 | |
69 | $languages["sv"]["NAME"] = "Swedish"; |
70 | $languages["sv"]["CHARSET"] = "iso-8859-1"; |
71 | |
cf7be4f2 |
72 | $languages["tw"]["NAME"] = "Taiwan"; |
73 | $languages["tw"]["CHARSET"] = "big5"; |
13e0c649 |
74 | |
d30d79f2 |
75 | |
1fd97780 |
76 | // Decodes a string to the internal encoding from the given charset |
77 | function charset_decode ($charset, $string) { |
e4a256af |
78 | global $debug_mime; |
79 | |
1fd97780 |
80 | // All HTML special characters are 7 bit and can be replaced first |
81 | $string = htmlspecialchars ($string); |
82 | |
44139266 |
83 | $charset = strtolower($charset); |
1fd97780 |
84 | |
e4a256af |
85 | if ($debug_mime) $string = $charset.":".$string; |
86 | |
3309f5b9 |
87 | if (ereg("iso-8859-([[:digit:]]+)", $charset, $res)) { |
1fd97780 |
88 | if ($res[1] == "1") |
89 | return charset_decode_iso_8859_1 ($string); |
e9d611cb |
90 | else if ($res[1] == "2") |
a89c13f5 |
91 | return charset_decode_iso_8859_2 ($string); |
e9d611cb |
92 | else if ($res[1] == "7") |
173ed887 |
93 | return charset_decode_iso_8859_7 ($string); |
1fd97780 |
94 | else if ($res[1] == "15") |
95 | return charset_decode_iso_8859_15 ($string); |
96 | else |
97 | return charset_decode_iso_8859_default ($string); |
98 | } else if ($charset == "ns_4551-1") { |
99 | return charset_decode_ns_4551_1 ($string); |
17ce8467 |
100 | } else if ($charset == "koi8-r") { |
101 | return charset_decode_koi8r ($string); |
209e2f82 |
102 | } else |
8c5a2cb2 |
103 | return "$string"; |
1fd97780 |
104 | } |
105 | |
106 | // iso-8859-1 is the same as Latin 1 and is normally used |
107 | // in western europe. |
108 | function charset_decode_iso_8859_1 ($string) { |
04563822 |
109 | global $default_charset; |
1fd97780 |
110 | |
04563822 |
111 | if (strtolower($default_charset) == "iso-8859-1") { |
112 | return $string; |
113 | } else { |
114 | // Only do the slow convert if there are 8-bit characters |
115 | if (ereg("[\200-\377]", $string)) { |
116 | $string = str_replace("\201", "", $string); |
117 | $string = str_replace("\202", "‚", $string); |
118 | $string = str_replace("\203", "ƒ", $string); |
119 | $string = str_replace("\204", "„", $string); |
120 | $string = str_replace("\205", "…", $string); |
121 | $string = str_replace("\206", "†", $string); |
122 | $string = str_replace("\207", "‡", $string); |
123 | $string = str_replace("\210", "ˆ", $string); |
124 | $string = str_replace("\211", "‰", $string); |
125 | $string = str_replace("\212", "Š", $string); |
126 | $string = str_replace("\213", "‹", $string); |
127 | $string = str_replace("\214", "Œ", $string); |
128 | $string = str_replace("\215", "", $string); |
129 | $string = str_replace("\216", "Ž", $string); |
130 | $string = str_replace("\217", "", $string); |
131 | $string = str_replace("\220", "", $string); |
132 | $string = str_replace("\221", "‘", $string); |
133 | $string = str_replace("\222", "’", $string); |
134 | $string = str_replace("\223", "“", $string); |
135 | $string = str_replace("\224", "”", $string); |
136 | $string = str_replace("\225", "•", $string); |
137 | $string = str_replace("\226", "–", $string); |
138 | $string = str_replace("\227", "—", $string); |
139 | $string = str_replace("\230", "˜", $string); |
140 | $string = str_replace("\231", "™", $string); |
141 | $string = str_replace("\232", "š", $string); |
142 | $string = str_replace("\233", "›", $string); |
143 | $string = str_replace("\234", "œ", $string); |
144 | $string = str_replace("\235", "", $string); |
145 | $string = str_replace("\236", "ž", $string); |
146 | $string = str_replace("\237", "Ÿ", $string); |
147 | $string = str_replace("\240", " ", $string); |
148 | $string = str_replace("\241", "¡", $string); |
149 | $string = str_replace("\242", "¢", $string); |
150 | $string = str_replace("\243", "£", $string); |
151 | $string = str_replace("\244", "¤", $string); |
152 | $string = str_replace("\245", "¥", $string); |
153 | $string = str_replace("\246", "¦", $string); |
154 | $string = str_replace("\247", "§", $string); |
155 | $string = str_replace("\250", "¨", $string); |
156 | $string = str_replace("\251", "©", $string); |
157 | $string = str_replace("\252", "ª", $string); |
158 | $string = str_replace("\253", "«", $string); |
159 | $string = str_replace("\254", "¬", $string); |
160 | $string = str_replace("\255", "­", $string); |
161 | $string = str_replace("\256", "®", $string); |
162 | $string = str_replace("\257", "¯", $string); |
163 | $string = str_replace("\260", "°", $string); |
164 | $string = str_replace("\261", "±", $string); |
165 | $string = str_replace("\262", "²", $string); |
166 | $string = str_replace("\263", "³", $string); |
167 | $string = str_replace("\264", "´", $string); |
168 | $string = str_replace("\265", "µ", $string); |
169 | $string = str_replace("\266", "¶", $string); |
170 | $string = str_replace("\267", "·", $string); |
171 | $string = str_replace("\270", "¸", $string); |
172 | $string = str_replace("\271", "¹", $string); |
173 | $string = str_replace("\272", "º", $string); |
174 | $string = str_replace("\273", "»", $string); |
175 | $string = str_replace("\274", "¼", $string); |
176 | $string = str_replace("\275", "½", $string); |
177 | $string = str_replace("\276", "¾", $string); |
178 | $string = str_replace("\277", "¿", $string); |
179 | $string = str_replace("\300", "À", $string); |
180 | $string = str_replace("\301", "Á", $string); |
181 | $string = str_replace("\302", "Â", $string); |
182 | $string = str_replace("\303", "Ã", $string); |
183 | $string = str_replace("\304", "Ä", $string); |
184 | $string = str_replace("\305", "Å", $string); |
185 | $string = str_replace("\306", "Æ", $string); |
186 | $string = str_replace("\307", "Ç", $string); |
187 | $string = str_replace("\310", "È", $string); |
188 | $string = str_replace("\311", "É", $string); |
189 | $string = str_replace("\312", "Ê", $string); |
190 | $string = str_replace("\313", "Ë", $string); |
191 | $string = str_replace("\314", "Ì", $string); |
192 | $string = str_replace("\315", "Í", $string); |
193 | $string = str_replace("\316", "Î", $string); |
194 | $string = str_replace("\317", "Ï", $string); |
195 | $string = str_replace("\320", "Ð", $string); |
196 | $string = str_replace("\321", "Ñ", $string); |
197 | $string = str_replace("\322", "Ò", $string); |
198 | $string = str_replace("\323", "Ó", $string); |
199 | $string = str_replace("\324", "Ô", $string); |
200 | $string = str_replace("\325", "Õ", $string); |
201 | $string = str_replace("\326", "Ö", $string); |
202 | $string = str_replace("\327", "×", $string); |
203 | $string = str_replace("\330", "Ø", $string); |
204 | $string = str_replace("\331", "Ù", $string); |
205 | $string = str_replace("\332", "Ú", $string); |
206 | $string = str_replace("\333", "Û", $string); |
207 | $string = str_replace("\334", "Ü", $string); |
208 | $string = str_replace("\335", "Ý", $string); |
209 | $string = str_replace("\336", "Þ", $string); |
210 | $string = str_replace("\337", "ß", $string); |
211 | $string = str_replace("\340", "à", $string); |
212 | $string = str_replace("\341", "á", $string); |
213 | $string = str_replace("\342", "â", $string); |
214 | $string = str_replace("\343", "ã", $string); |
215 | $string = str_replace("\344", "ä", $string); |
216 | $string = str_replace("\345", "å", $string); |
217 | $string = str_replace("\346", "æ", $string); |
218 | $string = str_replace("\347", "ç", $string); |
219 | $string = str_replace("\350", "è", $string); |
220 | $string = str_replace("\351", "é", $string); |
221 | $string = str_replace("\352", "ê", $string); |
222 | $string = str_replace("\353", "ë", $string); |
223 | $string = str_replace("\354", "ì", $string); |
224 | $string = str_replace("\355", "í", $string); |
225 | $string = str_replace("\356", "î", $string); |
226 | $string = str_replace("\357", "ï", $string); |
227 | $string = str_replace("\360", "ð", $string); |
228 | $string = str_replace("\361", "ñ", $string); |
229 | $string = str_replace("\362", "ò", $string); |
230 | $string = str_replace("\363", "ó", $string); |
231 | $string = str_replace("\364", "ô", $string); |
232 | $string = str_replace("\365", "õ", $string); |
233 | $string = str_replace("\366", "ö", $string); |
234 | $string = str_replace("\367", "÷", $string); |
235 | $string = str_replace("\370", "ø", $string); |
236 | $string = str_replace("\371", "ù", $string); |
237 | $string = str_replace("\372", "ú", $string); |
238 | $string = str_replace("\373", "û", $string); |
239 | $string = str_replace("\374", "ü", $string); |
240 | $string = str_replace("\375", "ý", $string); |
241 | $string = str_replace("\376", "þ", $string); |
242 | $string = str_replace("\377", "ÿ", $string); |
243 | } |
244 | } |
1fd97780 |
245 | |
246 | return ($string); |
247 | } |
248 | |
a89c13f5 |
249 | // iso-8859-2 is used for some eastern European languages |
250 | function charset_decode_iso_8859_2 ($string) { |
251 | global $default_charset; |
252 | |
e9d611cb |
253 | if (strtolower($default_charset) == "iso-8859-2") { |
a89c13f5 |
254 | return $string; |
255 | } else { |
256 | // Only do the slow convert if there are 8-bit characters |
257 | if (ereg("[\200-\377]", $string)) { |
258 | // NO-BREAK SPACE |
66488126 |
259 | $string = str_replace("\240", " ", $string); |
a89c13f5 |
260 | // LATIN CAPITAL LETTER A WITH OGONEK |
66488126 |
261 | $string = str_replace("\241", "Ą", $string); |
a89c13f5 |
262 | // BREVE |
66488126 |
263 | $string = str_replace("\242", "˘", $string); |
a89c13f5 |
264 | // LATIN CAPITAL LETTER L WITH STROKE |
66488126 |
265 | $string = str_replace("\243", "Ł", $string); |
a89c13f5 |
266 | // CURRENCY SIGN |
66488126 |
267 | $string = str_replace("\244", "¤", $string); |
a89c13f5 |
268 | // LATIN CAPITAL LETTER L WITH CARON |
66488126 |
269 | $string = str_replace("\245", "Ľ", $string); |
a89c13f5 |
270 | // LATIN CAPITAL LETTER S WITH ACUTE |
66488126 |
271 | $string = str_replace("\246", "Ś", $string); |
a89c13f5 |
272 | // SECTION SIGN |
66488126 |
273 | $string = str_replace("\247", "§", $string); |
a89c13f5 |
274 | // DIAERESIS |
66488126 |
275 | $string = str_replace("\250", "¨", $string); |
a89c13f5 |
276 | // LATIN CAPITAL LETTER S WITH CARON |
66488126 |
277 | $string = str_replace("\251", "Š", $string); |
a89c13f5 |
278 | // LATIN CAPITAL LETTER S WITH CEDILLA |
66488126 |
279 | $string = str_replace("\252", "Ş", $string); |
a89c13f5 |
280 | // LATIN CAPITAL LETTER T WITH CARON |
66488126 |
281 | $string = str_replace("\253", "Ť", $string); |
a89c13f5 |
282 | // LATIN CAPITAL LETTER Z WITH ACUTE |
66488126 |
283 | $string = str_replace("\254", "Ź", $string); |
a89c13f5 |
284 | // SOFT HYPHEN |
66488126 |
285 | $string = str_replace("\255", "­", $string); |
a89c13f5 |
286 | // LATIN CAPITAL LETTER Z WITH CARON |
66488126 |
287 | $string = str_replace("\256", "Ž", $string); |
a89c13f5 |
288 | // LATIN CAPITAL LETTER Z WITH DOT ABOVE |
66488126 |
289 | $string = str_replace("\257", "Ż", $string); |
a89c13f5 |
290 | // DEGREE SIGN |
66488126 |
291 | $string = str_replace("\260", "°", $string); |
a89c13f5 |
292 | // LATIN SMALL LETTER A WITH OGONEK |
66488126 |
293 | $string = str_replace("\261", "ą", $string); |
a89c13f5 |
294 | // OGONEK |
66488126 |
295 | $string = str_replace("\262", "˛", $string); |
a89c13f5 |
296 | // LATIN SMALL LETTER L WITH STROKE |
66488126 |
297 | $string = str_replace("\263", "ł", $string); |
a89c13f5 |
298 | // ACUTE ACCENT |
66488126 |
299 | $string = str_replace("\264", "´", $string); |
a89c13f5 |
300 | // LATIN SMALL LETTER L WITH CARON |
66488126 |
301 | $string = str_replace("\265", "ľ", $string); |
a89c13f5 |
302 | // LATIN SMALL LETTER S WITH ACUTE |
66488126 |
303 | $string = str_replace("\266", "ś", $string); |
a89c13f5 |
304 | // CARON |
66488126 |
305 | $string = str_replace("\267", "ˇ", $string); |
a89c13f5 |
306 | // CEDILLA |
66488126 |
307 | $string = str_replace("\270", "¸", $string); |
a89c13f5 |
308 | // LATIN SMALL LETTER S WITH CARON |
66488126 |
309 | $string = str_replace("\271", "š", $string); |
a89c13f5 |
310 | // LATIN SMALL LETTER S WITH CEDILLA |
66488126 |
311 | $string = str_replace("\272", "ş", $string); |
a89c13f5 |
312 | // LATIN SMALL LETTER T WITH CARON |
66488126 |
313 | $string = str_replace("\273", "ť", $string); |
a89c13f5 |
314 | // LATIN SMALL LETTER Z WITH ACUTE |
66488126 |
315 | $string = str_replace("\274", "ź", $string); |
a89c13f5 |
316 | // DOUBLE ACUTE ACCENT |
66488126 |
317 | $string = str_replace("\275", "˝", $string); |
a89c13f5 |
318 | // LATIN SMALL LETTER Z WITH CARON |
66488126 |
319 | $string = str_replace("\276", "ž", $string); |
a89c13f5 |
320 | // LATIN SMALL LETTER Z WITH DOT ABOVE |
66488126 |
321 | $string = str_replace("\277", "ż", $string); |
a89c13f5 |
322 | // LATIN CAPITAL LETTER R WITH ACUTE |
66488126 |
323 | $string = str_replace("\300", "Ŕ", $string); |
a89c13f5 |
324 | // LATIN CAPITAL LETTER A WITH ACUTE |
66488126 |
325 | $string = str_replace("\301", "Á", $string); |
a89c13f5 |
326 | // LATIN CAPITAL LETTER A WITH CIRCUMFLEX |
66488126 |
327 | $string = str_replace("\302", "Â", $string); |
a89c13f5 |
328 | // LATIN CAPITAL LETTER A WITH BREVE |
66488126 |
329 | $string = str_replace("\303", "Ă", $string); |
a89c13f5 |
330 | // LATIN CAPITAL LETTER A WITH DIAERESIS |
66488126 |
331 | $string = str_replace("\304", "Ä", $string); |
a89c13f5 |
332 | // LATIN CAPITAL LETTER L WITH ACUTE |
66488126 |
333 | $string = str_replace("\305", "Ĺ", $string); |
a89c13f5 |
334 | // LATIN CAPITAL LETTER C WITH ACUTE |
66488126 |
335 | $string = str_replace("\306", "Ć", $string); |
a89c13f5 |
336 | // LATIN CAPITAL LETTER C WITH CEDILLA |
66488126 |
337 | $string = str_replace("\307", "Ç", $string); |
a89c13f5 |
338 | // LATIN CAPITAL LETTER C WITH CARON |
66488126 |
339 | $string = str_replace("\310", "Č", $string); |
a89c13f5 |
340 | // LATIN CAPITAL LETTER E WITH ACUTE |
66488126 |
341 | $string = str_replace("\311", "É", $string); |
a89c13f5 |
342 | // LATIN CAPITAL LETTER E WITH OGONEK |
66488126 |
343 | $string = str_replace("\312", "Ę", $string); |
a89c13f5 |
344 | // LATIN CAPITAL LETTER E WITH DIAERESIS |
66488126 |
345 | $string = str_replace("\313", "Ë", $string); |
a89c13f5 |
346 | // LATIN CAPITAL LETTER E WITH CARON |
66488126 |
347 | $string = str_replace("\314", "Ě", $string); |
a89c13f5 |
348 | // LATIN CAPITAL LETTER I WITH ACUTE |
66488126 |
349 | $string = str_replace("\315", "Í", $string); |
a89c13f5 |
350 | // LATIN CAPITAL LETTER I WITH CIRCUMFLEX |
66488126 |
351 | $string = str_replace("\316", "Î", $string); |
a89c13f5 |
352 | // LATIN CAPITAL LETTER D WITH CARON |
66488126 |
353 | $string = str_replace("\317", "Ď", $string); |
a89c13f5 |
354 | // LATIN CAPITAL LETTER D WITH STROKE |
66488126 |
355 | $string = str_replace("\320", "Đ", $string); |
a89c13f5 |
356 | // LATIN CAPITAL LETTER N WITH ACUTE |
66488126 |
357 | $string = str_replace("\321", "Ń", $string); |
a89c13f5 |
358 | // LATIN CAPITAL LETTER N WITH CARON |
66488126 |
359 | $string = str_replace("\322", "Ň", $string); |
a89c13f5 |
360 | // LATIN CAPITAL LETTER O WITH ACUTE |
66488126 |
361 | $string = str_replace("\323", "Ó", $string); |
a89c13f5 |
362 | // LATIN CAPITAL LETTER O WITH CIRCUMFLEX |
66488126 |
363 | $string = str_replace("\324", "Ô", $string); |
a89c13f5 |
364 | // LATIN CAPITAL LETTER O WITH DOUBLE ACUTE |
66488126 |
365 | $string = str_replace("\325", "Ő", $string); |
a89c13f5 |
366 | // LATIN CAPITAL LETTER O WITH DIAERESIS |
66488126 |
367 | $string = str_replace("\326", "Ö", $string); |
a89c13f5 |
368 | // MULTIPLICATION SIGN |
66488126 |
369 | $string = str_replace("\327", "×", $string); |
a89c13f5 |
370 | // LATIN CAPITAL LETTER R WITH CARON |
66488126 |
371 | $string = str_replace("\330", "Ř", $string); |
a89c13f5 |
372 | // LATIN CAPITAL LETTER U WITH RING ABOVE |
66488126 |
373 | $string = str_replace("\331", "Ů", $string); |
a89c13f5 |
374 | // LATIN CAPITAL LETTER U WITH ACUTE |
66488126 |
375 | $string = str_replace("\332", "Ú", $string); |
a89c13f5 |
376 | // LATIN CAPITAL LETTER U WITH DOUBLE ACUTE |
66488126 |
377 | $string = str_replace("\333", "Ű", $string); |
a89c13f5 |
378 | // LATIN CAPITAL LETTER U WITH DIAERESIS |
66488126 |
379 | $string = str_replace("\334", "Ü", $string); |
a89c13f5 |
380 | // LATIN CAPITAL LETTER Y WITH ACUTE |
66488126 |
381 | $string = str_replace("\335", "Ý", $string); |
a89c13f5 |
382 | // LATIN CAPITAL LETTER T WITH CEDILLA |
66488126 |
383 | $string = str_replace("\336", "Ţ", $string); |
a89c13f5 |
384 | // LATIN SMALL LETTER SHARP S |
66488126 |
385 | $string = str_replace("\337", "ß", $string); |
a89c13f5 |
386 | // LATIN SMALL LETTER R WITH ACUTE |
66488126 |
387 | $string = str_replace("\340", "ŕ", $string); |
a89c13f5 |
388 | // LATIN SMALL LETTER A WITH ACUTE |
66488126 |
389 | $string = str_replace("\341", "á", $string); |
a89c13f5 |
390 | // LATIN SMALL LETTER A WITH CIRCUMFLEX |
66488126 |
391 | $string = str_replace("\342", "â", $string); |
a89c13f5 |
392 | // LATIN SMALL LETTER A WITH BREVE |
66488126 |
393 | $string = str_replace("\343", "ă", $string); |
a89c13f5 |
394 | // LATIN SMALL LETTER A WITH DIAERESIS |
66488126 |
395 | $string = str_replace("\344", "ä", $string); |
a89c13f5 |
396 | // LATIN SMALL LETTER L WITH ACUTE |
66488126 |
397 | $string = str_replace("\345", "ĺ", $string); |
a89c13f5 |
398 | // LATIN SMALL LETTER C WITH ACUTE |
66488126 |
399 | $string = str_replace("\346", "ć", $string); |
a89c13f5 |
400 | // LATIN SMALL LETTER C WITH CEDILLA |
66488126 |
401 | $string = str_replace("\347", "ç", $string); |
a89c13f5 |
402 | // LATIN SMALL LETTER C WITH CARON |
66488126 |
403 | $string = str_replace("\350", "č", $string); |
a89c13f5 |
404 | // LATIN SMALL LETTER E WITH ACUTE |
66488126 |
405 | $string = str_replace("\351", "é", $string); |
a89c13f5 |
406 | // LATIN SMALL LETTER E WITH OGONEK |
66488126 |
407 | $string = str_replace("\352", "ę", $string); |
a89c13f5 |
408 | // LATIN SMALL LETTER E WITH DIAERESIS |
66488126 |
409 | $string = str_replace("\353", "ë", $string); |
a89c13f5 |
410 | // LATIN SMALL LETTER E WITH CARON |
66488126 |
411 | $string = str_replace("\354", "ě", $string); |
a89c13f5 |
412 | // LATIN SMALL LETTER I WITH ACUTE |
66488126 |
413 | $string = str_replace("\355", "í", $string); |
a89c13f5 |
414 | // LATIN SMALL LETTER I WITH CIRCUMFLEX |
66488126 |
415 | $string = str_replace("\356", "î", $string); |
a89c13f5 |
416 | // LATIN SMALL LETTER D WITH CARON |
66488126 |
417 | $string = str_replace("\357", "ď", $string); |
a89c13f5 |
418 | // LATIN SMALL LETTER D WITH STROKE |
66488126 |
419 | $string = str_replace("\360", "đ", $string); |
a89c13f5 |
420 | // LATIN SMALL LETTER N WITH ACUTE |
66488126 |
421 | $string = str_replace("\361", "ń", $string); |
a89c13f5 |
422 | // LATIN SMALL LETTER N WITH CARON |
66488126 |
423 | $string = str_replace("\362", "ň", $string); |
a89c13f5 |
424 | // LATIN SMALL LETTER O WITH ACUTE |
66488126 |
425 | $string = str_replace("\363", "ó", $string); |
a89c13f5 |
426 | // LATIN SMALL LETTER O WITH CIRCUMFLEX |
66488126 |
427 | $string = str_replace("\364", "ô", $string); |
a89c13f5 |
428 | // LATIN SMALL LETTER O WITH DOUBLE ACUTE |
66488126 |
429 | $string = str_replace("\365", "ő", $string); |
a89c13f5 |
430 | // LATIN SMALL LETTER O WITH DIAERESIS |
66488126 |
431 | $string = str_replace("\366", "ö", $string); |
a89c13f5 |
432 | // DIVISION SIGN |
66488126 |
433 | $string = str_replace("\367", "÷", $string); |
a89c13f5 |
434 | // LATIN SMALL LETTER R WITH CARON |
66488126 |
435 | $string = str_replace("\370", "ř", $string); |
a89c13f5 |
436 | // LATIN SMALL LETTER U WITH RING ABOVE |
66488126 |
437 | $string = str_replace("\371", "ů", $string); |
a89c13f5 |
438 | // LATIN SMALL LETTER U WITH ACUTE |
66488126 |
439 | $string = str_replace("\372", "ú", $string); |
a89c13f5 |
440 | // LATIN SMALL LETTER U WITH DOUBLE ACUTE |
66488126 |
441 | $string = str_replace("\373", "ű", $string); |
a89c13f5 |
442 | // LATIN SMALL LETTER U WITH DIAERESIS |
66488126 |
443 | $string = str_replace("\374", "ü", $string); |
a89c13f5 |
444 | // LATIN SMALL LETTER Y WITH ACUTE |
66488126 |
445 | $string = str_replace("\375", "ý", $string); |
a89c13f5 |
446 | // LATIN SMALL LETTER T WITH CEDILLA |
66488126 |
447 | $string = str_replace("\376", "ţ", $string); |
a89c13f5 |
448 | // DOT ABOVE |
66488126 |
449 | $string = str_replace("\377", "˙", $string); |
a89c13f5 |
450 | } |
451 | } |
452 | return $string; |
453 | } |
454 | |
0a86e9f3 |
455 | // iso-8859-7 is Greek. |
209e2f82 |
456 | function charset_decode_iso_8859_7 ($string) { |
04563822 |
457 | global $default_charset; |
173ed887 |
458 | |
04563822 |
459 | if (strtolower($default_charset) == "iso-8859-7") { |
460 | return $string; |
461 | } else { |
462 | // Only do the slow convert if there are 8-bit characters |
463 | if (ereg("[\200-\377]", $string)) { |
464 | // Some diverse characters in the beginning |
465 | $string = str_replace("\240", " ", $string); |
466 | $string = str_replace("\241", "‘", $string); |
467 | $string = str_replace("\242", "’", $string); |
468 | $string = str_replace("\243", "£", $string); |
469 | $string = str_replace("\246", "¦", $string); |
470 | $string = str_replace("\247", "§", $string); |
471 | $string = str_replace("\250", "¨", $string); |
472 | $string = str_replace("\251", "©", $string); |
473 | $string = str_replace("\253", "«", $string); |
474 | $string = str_replace("\254", "¬", $string); |
475 | $string = str_replace("\255", "­", $string); |
476 | $string = str_replace("\257", "―", $string); |
477 | $string = str_replace("\260", "°", $string); |
478 | $string = str_replace("\261", "±", $string); |
479 | $string = str_replace("\262", "²", $string); |
480 | $string = str_replace("\263", "³", $string); |
481 | |
482 | // Horizontal bar (parentheki pavla) |
483 | $string = str_replace ("\257", "―", $string); |
484 | |
485 | // ISO-8859-7 characters from 11/04 (0xB4) to 11/06 (0xB6) |
486 | // These are Unicode 900-902 |
487 | while (ereg("([\264-\266])", $string, $res)) { |
488 | $replace = "&#" . (ord($res[1])+720) . ";"; |
489 | $string = str_replace($res[1], $replace, $string); |
490 | } |
491 | |
492 | // 11/07 (0xB7) Middle dot is the same in iso-8859-1 |
493 | $string = str_replace("\267", "·", $string); |
494 | |
495 | // ISO-8859-7 characters from 11/08 (0xB8) to 11/10 (0xBA) |
496 | // These are Unicode 900-902 |
497 | while (ereg("([\270-\272])", $string, $res)) { |
498 | $replace = "&#" . (ord($res[1])+720) . ";"; |
499 | $string = str_replace($res[1], $replace, $string); |
500 | } |
501 | |
502 | // 11/11 (0xBB) Right angle quotation mark is the same as in |
503 | // iso-8859-1 |
504 | $string = str_replace("\273", "»", $string); |
505 | |
506 | // And now the rest of the charset |
507 | while (ereg("([\274-\376])", $string, $res)) { |
508 | $replace = "&#" . (ord($res[1])+720) . ";"; |
509 | $string = str_replace($res[1], $replace, $string); |
510 | } |
511 | } |
173ed887 |
512 | } |
513 | |
514 | return $string; |
515 | } |
516 | |
a89c13f5 |
517 | // iso-8859-15 is Latin 9 and has very much the same use as Latin 1 |
1fd97780 |
518 | // but has the Euro symbol and some characters needed for French. |
519 | function charset_decode_iso_8859_15 ($string) { |
520 | // Euro sign |
d23e472b |
521 | $string = str_replace ("\244", "€", $string); |
1fd97780 |
522 | // Latin capital letter S with caron |
d23e472b |
523 | $string = str_replace ("\244", "Š", $string); |
1fd97780 |
524 | // Latin small letter s with caron |
d23e472b |
525 | $string = str_replace ("\250", "š", $string); |
1fd97780 |
526 | // Latin capital letter Z with caron |
d23e472b |
527 | $string = str_replace ("\264", "Ž", $string); |
1fd97780 |
528 | // Latin small letter z with caron |
d23e472b |
529 | $string = str_replace ("\270", "ž", $string); |
1fd97780 |
530 | // Latin capital ligature OE |
d23e472b |
531 | $string = str_replace ("\274", "Œ", $string); |
1fd97780 |
532 | // Latin small ligature oe |
d23e472b |
533 | $string = str_replace ("\275", "œ", $string); |
1fd97780 |
534 | // Latin capital letter Y with diaeresis |
d23e472b |
535 | $string = str_replace ("\276", "Ÿ", $string); |
1fd97780 |
536 | |
04563822 |
537 | return (charset_decode_iso_8859_1($string)); |
1fd97780 |
538 | } |
539 | |
17ce8467 |
540 | // ISO-8859-15 is Cyrillic |
541 | function charset_decode_iso_8859_5 ($string) { |
d23e472b |
542 | // Convert to KOI8-R, then return this decoded. |
543 | $string = convert_cyr_string($string, "i", "k"); |
544 | return charset_decode_koi8r($string); |
17ce8467 |
545 | } |
546 | |
173ed887 |
547 | // Remove all 8 bit characters from all other ISO-8859 character sets |
1fd97780 |
548 | function charset_decode_iso_8859_default ($string) { |
549 | return (strtr($string, "\240\241\242\243\244\245\246\247". |
550 | "\250\251\252\253\254\255\256\257". |
551 | "\260\261\262\263\264\265\266\267". |
552 | "\270\271\272\273\274\275\276\277". |
553 | "\300\301\302\303\304\305\306\307". |
554 | "\310\311\312\313\314\315\316\317". |
555 | "\320\321\322\323\324\325\326\327". |
556 | "\330\331\332\333\334\335\336\337". |
557 | "\340\341\342\343\344\345\346\347". |
558 | "\350\351\352\353\354\355\356\357". |
559 | "\360\361\362\363\364\365\366\367". |
560 | "\370\371\372\373\374\375\376\377", |
561 | "????????????????????????????????????????". |
562 | "????????????????????????????????????????". |
563 | "????????????????????????????????????????". |
564 | "????????")); |
565 | |
566 | } |
567 | |
568 | // This is the same as ISO-646-NO and is used by some |
569 | // Microsoft programs when sending Norwegian characters |
570 | function charset_decode_ns_4551_1 ($string) { |
571 | // These characters are: |
572 | // Latin capital letter AE |
573 | // Latin capital letter O with stroke |
574 | // Latin capital letter A with ring above |
575 | // and the same as small letters |
576 |