d672fcab |
1 | <?php |
d6c32258 |
2 | /** |
d672fcab |
3 | * decode/iso8859-15.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-15 decoding function that is needed to read |
9 | * iso-8859-15 encoded mails in non-iso-8859-15 locale. |
91e0dccc |
10 | * |
d672fcab |
11 | * Original data taken from: |
12 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT |
13 | * |
14 | * Name: ISO/IEC 8859-15:1999 to Unicode |
15 | * Unicode version: 3.0 |
16 | * Table version: 1.0 |
17 | * Table format: Format A |
18 | * Date: 1999 July 27 |
19 | * Authors: Markus Kuhn <mkuhn@acm.org> |
e53c9681 |
20 | * Ken Whistler <kenw@sybase.com> |
d672fcab |
21 | * |
22 | * Original copyright: |
e53c9681 |
23 | * Copyright (c) 1999 Unicode, Inc. All Rights reserved. |
d672fcab |
24 | * |
e53c9681 |
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. |
d672fcab |
32 | * |
e53c9681 |
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. |
31841a9e |
38 | * |
39 | * @version $Id$ |
d6c32258 |
40 | * @package squirrelmail |
41 | * @subpackage decode |
42 | */ |
43 | |
44 | /** |
45 | * Decode iso8859-15 encoded string |
46 | * @param string $string Encoded string |
47 | * @return string $string Decoded string |
d672fcab |
48 | */ |
df8c4d6d |
49 | function charset_decode_iso_8859_15 ($string) { |
d672fcab |
50 | global $default_charset; |
51 | |
52 | if (strtolower($default_charset) == 'iso-8859-15') |
53 | return $string; |
54 | |
e53c9681 |
55 | // don't do decoding when there are no 8bit symbols |
56 | if (! sq_is8bit($string,'iso-8859-15')) |
d672fcab |
57 | return $string; |
58 | |
59 | $iso8859_15 = array( |
e53c9681 |
60 | "\xA0" => ' ', |
61 | "\xA1" => '¡', |
62 | "\xA2" => '¢', |
63 | "\xA3" => '£', |
64 | "\xA4" => '€', |
65 | "\xA5" => '¥', |
66 | "\xA6" => 'Š', |
67 | "\xA7" => '§', |
68 | "\xA8" => 'š', |
69 | "\xA9" => '©', |
70 | "\xAA" => 'ª', |
71 | "\xAB" => '«', |
72 | "\xAC" => '¬', |
73 | "\xAD" => '­', |
74 | "\xAE" => '®', |
75 | "\xAF" => '¯', |
76 | "\xB0" => '°', |
77 | "\xB1" => '±', |
78 | "\xB2" => '²', |
79 | "\xB3" => '³', |
80 | "\xB4" => 'Ž', |
81 | "\xB5" => 'µ', |
82 | "\xB6" => '¶', |
83 | "\xB7" => '·', |
84 | "\xB8" => 'ž', |
85 | "\xB9" => '¹', |
86 | "\xBA" => 'º', |
87 | "\xBB" => '»', |
88 | "\xBC" => 'Œ', |
89 | "\xBD" => 'œ', |
90 | "\xBE" => 'Ÿ', |
91 | "\xBF" => '¿', |
92 | "\xC0" => 'À', |
93 | "\xC1" => 'Á', |
94 | "\xC2" => 'Â', |
95 | "\xC3" => 'Ã', |
96 | "\xC4" => 'Ä', |
97 | "\xC5" => 'Å', |
98 | "\xC6" => 'Æ', |
99 | "\xC7" => 'Ç', |
100 | "\xC8" => 'È', |
101 | "\xC9" => 'É', |
102 | "\xCA" => 'Ê', |
103 | "\xCB" => 'Ë', |
104 | "\xCC" => 'Ì', |
105 | "\xCD" => 'Í', |
106 | "\xCE" => 'Î', |
107 | "\xCF" => 'Ï', |
108 | "\xD0" => 'Ð', |
109 | "\xD1" => 'Ñ', |
110 | "\xD2" => 'Ò', |
111 | "\xD3" => 'Ó', |
112 | "\xD4" => 'Ô', |
113 | "\xD5" => 'Õ', |
114 | "\xD6" => 'Ö', |
115 | "\xD7" => '×', |
116 | "\xD8" => 'Ø', |
117 | "\xD9" => 'Ù', |
118 | "\xDA" => 'Ú', |
119 | "\xDB" => 'Û', |
120 | "\xDC" => 'Ü', |
121 | "\xDD" => 'Ý', |
122 | "\xDE" => 'Þ', |
123 | "\xDF" => 'ß', |
124 | "\xE0" => 'à', |
125 | "\xE1" => 'á', |
126 | "\xE2" => 'â', |
127 | "\xE3" => 'ã', |
128 | "\xE4" => 'ä', |
129 | "\xE5" => 'å', |
130 | "\xE6" => 'æ', |
131 | "\xE7" => 'ç', |
132 | "\xE8" => 'è', |
133 | "\xE9" => 'é', |
134 | "\xEA" => 'ê', |
135 | "\xEB" => 'ë', |
136 | "\xEC" => 'ì', |
137 | "\xED" => 'í', |
138 | "\xEE" => 'î', |
139 | "\xEF" => 'ï', |
140 | "\xF0" => 'ð', |
141 | "\xF1" => 'ñ', |
142 | "\xF2" => 'ò', |
143 | "\xF3" => 'ó', |
144 | "\xF4" => 'ô', |
145 | "\xF5" => 'õ', |
146 | "\xF6" => 'ö', |
147 | "\xF7" => '÷', |
148 | "\xF8" => 'ø', |
149 | "\xF9" => 'ù', |
150 | "\xFA" => 'ú', |
151 | "\xFB" => 'û', |
152 | "\xFC" => 'ü', |
153 | "\xFD" => 'ý', |
154 | "\xFE" => 'þ', |
155 | "\xFF" => 'ÿ' |
d672fcab |
156 | ); |
157 | |
158 | $string = str_replace(array_keys($iso8859_15), array_values($iso8859_15), $string); |
159 | |
160 | return $string; |
161 | } |
e53c9681 |
162 | ?> |