d672fcab |
1 | <?php |
d6c32258 |
2 | /** |
d672fcab |
3 | * decode/iso8859-16.php |
d672fcab |
4 | * |
82d304a0 |
5 | * Copyright (c) 2003-2004 The SquirrelMail Project Team |
d672fcab |
6 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
7 | * |
8 | * This file contains iso-8859-16 decoding function that is needed to read |
9 | * iso-8859-16 encoded mails in non-iso-8859-16 locale. |
10 | * |
11 | * Original data taken from: |
12 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-16.TXT |
13 | * |
14 | * Name: ISO/IEC 8859-16:2001 to Unicode |
15 | * Unicode version: 3.0 |
16 | * Table version: 1.0 |
17 | * Table format: Format A |
18 | * Date: 2001 July 26 |
19 | * Authors: Markus Kuhn <mkuhn@acm.org> |
20 | * |
21 | * Original copyright: |
e53c9681 |
22 | * Copyright (c) 1999 Unicode, Inc. All Rights reserved. |
d672fcab |
23 | * |
e53c9681 |
24 | * This file is provided as-is by Unicode, Inc. (The Unicode Consortium). |
25 | * No claims are made as to fitness for any particular purpose. No |
26 | * warranties of any kind are expressed or implied. The recipient |
27 | * agrees to determine applicability of information provided. If this |
28 | * file has been provided on optical media by Unicode, Inc., the sole |
29 | * remedy for any claim will be exchange of defective media within 90 |
30 | * days of receipt. |
d672fcab |
31 | * |
e53c9681 |
32 | * Unicode, Inc. hereby grants the right to freely use the information |
33 | * supplied in this file in the creation of products supporting the |
34 | * Unicode Standard, and to make copies of this file in any form for |
35 | * internal or external distribution as long as this notice remains |
36 | * attached. |
31841a9e |
37 | * |
38 | * @version $Id$ |
d6c32258 |
39 | * @package squirrelmail |
40 | * @subpackage decode |
41 | */ |
42 | |
43 | /** |
44 | * Decode iso8859-16 string |
45 | * @param string $string Encoded string |
46 | * @return string $string Decoded string |
d672fcab |
47 | */ |
df8c4d6d |
48 | function charset_decode_iso_8859_16 ($string) { |
d672fcab |
49 | global $default_charset; |
50 | |
51 | if (strtolower($default_charset) == 'iso-8859-16') |
52 | return $string; |
53 | |
e53c9681 |
54 | // don't do decoding when there are no 8bit symbols |
55 | if (! sq_is8bit($string,'iso-8859-16')) |
d672fcab |
56 | return $string; |
57 | |
58 | $iso8869_16 = array( |
e53c9681 |
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 | "\xDB" => 'Û', |
119 | "\xDC" => 'Ü', |
120 | "\xDD" => 'Ę', |
121 | "\xDE" => 'Ț', |
122 | "\xDF" => 'ß', |
123 | "\xE0" => 'à', |
124 | "\xE1" => 'á', |
125 | "\xE2" => 'â', |
126 | "\xE3" => 'ă', |
127 | "\xE4" => 'ä', |
128 | "\xE5" => 'ć', |
129 | "\xE6" => 'æ', |
130 | "\xE7" => 'ç', |
131 | "\xE8" => 'è', |
132 | "\xE9" => 'é', |
133 | "\xEA" => 'ê', |
134 | "\xEB" => 'ë', |
135 | "\xEC" => 'ì', |
136 | "\xED" => 'í', |
137 | "\xEE" => 'î', |
138 | "\xEF" => 'ï', |
139 | "\xF0" => 'đ', |
140 | "\xF1" => 'ń', |
141 | "\xF2" => 'ò', |
142 | "\xF3" => 'ó', |
143 | "\xF4" => 'ô', |
144 | "\xF5" => 'ő', |
145 | "\xF6" => 'ö', |
146 | "\xF7" => 'ś', |
147 | "\xF8" => 'ű', |
148 | "\xF9" => 'ù', |
149 | "\xFA" => 'ú', |
150 | "\xFB" => 'û', |
151 | "\xFC" => 'ü', |
152 | "\xFD" => 'ę', |
153 | "\xFE" => 'ț', |
154 | "\xFF" => 'ÿ' |
d672fcab |
155 | ); |
156 | |
157 | $string = str_replace(array_keys($iso8859_16), array_values($iso8859_16), $string); |
158 | |
159 | return $string; |
160 | } |
e53c9681 |
161 | ?> |