d672fcab |
1 | <?php |
d6c32258 |
2 | /** |
d672fcab |
3 | * decode/iso8859-11.php |
4 | * $Id$ |
5 | * |
0a708025 |
6 | * Copyright (c) 2003 The SquirrelMail Project Team |
d672fcab |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
9 | * This file contains iso-8859-11 decoding function that is needed to read |
10 | * iso-8859-11 encoded mails in non-iso-8859-11 locale. |
11 | * |
12 | * Original data taken from: |
13 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-11.TXT |
14 | * |
15 | * Name: ISO/IEC 8859-11:2001 to Unicode |
16 | * Unicode version: 3.2 |
17 | * Table version: 1.0 |
18 | * Table format: Format A |
19 | * Date: 2002 October 7 |
20 | * Authors: Ken Whistler <kenw@sybase.com> |
21 | * |
22 | * Original copyright: |
23 | * Copyright (c) 1999 Unicode, Inc. All Rights reserved. |
24 | * |
25 | * This file is provided as-is by Unicode, Inc. (The Unicode Consortium). |
26 | * No claims are made as to fitness for any particular purpose. No |
27 | * warranties of any kind are expressed or implied. The recipient |
28 | * agrees to determine applicability of information provided. If this |
29 | * file has been provided on optical media by Unicode, Inc., the sole |
30 | * remedy for any claim will be exchange of defective media within 90 |
31 | * days of receipt. |
32 | * |
33 | * Unicode, Inc. hereby grants the right to freely use the information |
34 | * supplied in this file in the creation of products supporting the |
35 | * Unicode Standard, and to make copies of this file in any form for |
36 | * internal or external distribution as long as this notice remains |
37 | * attached. |
d6c32258 |
38 | * @package squirrelmail |
39 | * @subpackage decode |
40 | */ |
41 | |
42 | /** |
43 | * Decode iso8859-11 string |
44 | * @param string $string Encoded string |
45 | * @return string $string Decoded string |
d672fcab |
46 | */ |
df8c4d6d |
47 | function charset_decode_iso_8859_11 ($string) { |
d672fcab |
48 | global $default_charset; |
49 | |
50 | if (strtolower($default_charset) == 'iso-8859-11') |
51 | return $string; |
52 | |
53 | /* Only do the slow convert if there are 8-bit characters */ |
54 | /* there is no 0x80-0x9F letters in ISO8859-* */ |
55 | if ( ! ereg("[\241-\377]", $string) ) |
56 | return $string; |
57 | |
58 | $iso8859_11 = array( |
59 | "\xA0" => ' ', |
60 | "\xA1" => 'ก', |
61 | "\xA2" => 'ข', |
62 | "\xA3" => 'ฃ', |
63 | "\xA4" => 'ค', |
64 | "\xA5" => 'ฅ', |
65 | "\xA6" => 'ฆ', |
66 | "\xA7" => 'ง', |
67 | "\xA8" => 'จ', |
68 | "\xA9" => 'ฉ', |
69 | "\xAA" => 'ช', |
70 | "\xAB" => 'ซ', |
71 | "\xAC" => 'ฌ', |
72 | "\xAD" => 'ญ', |
73 | "\xAE" => 'ฎ', |
74 | "\xAF" => 'ฏ', |
75 | "\xB0" => 'ฐ', |
76 | "\xB1" => 'ฑ', |
77 | "\xB2" => 'ฒ', |
78 | "\xB3" => 'ณ', |
79 | "\xB4" => 'ด', |
80 | "\xB5" => 'ต', |
81 | "\xB6" => 'ถ', |
82 | "\xB7" => 'ท', |
83 | "\xB8" => 'ธ', |
84 | "\xB9" => 'น', |
85 | "\xBA" => 'บ', |
86 | "\xBB" => 'ป', |
87 | "\xBC" => 'ผ', |
88 | "\xBD" => 'ฝ', |
89 | "\xBE" => 'พ', |
90 | "\xBF" => 'ฟ', |
91 | "\xC0" => 'ภ', |
92 | "\xC1" => 'ม', |
93 | "\xC2" => 'ย', |
94 | "\xC3" => 'ร', |
95 | "\xC4" => 'ฤ', |
96 | "\xC5" => 'ล', |
97 | "\xC6" => 'ฦ', |
98 | "\xC7" => 'ว', |
99 | "\xC8" => 'ศ', |
100 | "\xC9" => 'ษ', |
101 | "\xCA" => 'ส', |
102 | "\xCB" => 'ห', |
103 | "\xCC" => 'ฬ', |
104 | "\xCD" => 'อ', |
105 | "\xCE" => 'ฮ', |
106 | "\xCF" => 'ฯ', |
107 | "\xD0" => 'ะ', |
108 | "\xD1" => 'ั', |
109 | "\xD2" => 'า', |
110 | "\xD3" => 'ำ', |
111 | "\xD4" => 'ิ', |
112 | "\xD5" => 'ี', |
113 | "\xD6" => 'ึ', |
114 | "\xD7" => 'ื', |
115 | "\xD8" => 'ุ', |
116 | "\xD9" => 'ู', |
117 | "\xDA" => 'ฺ', |
118 | "\xDF" => '฿', |
119 | "\xE0" => 'เ', |
120 | "\xE1" => 'แ', |
121 | "\xE2" => 'โ', |
122 | "\xE3" => 'ใ', |
123 | "\xE4" => 'ไ', |
124 | "\xE5" => 'ๅ', |
125 | "\xE6" => 'ๆ', |
126 | "\xE7" => '็', |
127 | "\xE8" => '่', |
128 | "\xE9" => '้', |
129 | "\xEA" => '๊', |
130 | "\xEB" => '๋', |
131 | "\xEC" => '์', |
132 | "\xED" => 'ํ', |
133 | "\xEE" => '๎', |
134 | "\xEF" => '๏', |
135 | "\xF0" => '๐', |
136 | "\xF1" => '๑', |
137 | "\xF2" => '๒', |
138 | "\xF3" => '๓', |
139 | "\xF4" => '๔', |
140 | "\xF5" => '๕', |
141 | "\xF6" => '๖', |
142 | "\xF7" => '๗', |
143 | "\xF8" => '๘', |
144 | "\xF9" => '๙', |
145 | "\xFA" => '๚', |
146 | "\xFB" => '๛' |
147 | ); |
148 | |
149 | $string = str_replace(array_keys($iso8859_11), array_values($iso8859_11), $string); |
150 | |
151 | return $string; |
152 | } |
153 | |
d6c32258 |
154 | ?> |