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