d672fcab |
1 | <?php |
d6c32258 |
2 | /** |
d672fcab |
3 | * decode/iso8859-13.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-13 decoding function that is needed to read |
10 | * iso-8859-13 encoded mails in non-iso-8859-13 locale. |
11 | * |
12 | * Original data taken from: |
13 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-13.TXT |
14 | * |
15 | * Name: ISO/IEC 8859-13:1998 to Unicode |
16 | * Unicode version: 3.0 |
17 | * Table version: 1.0 |
18 | * Table format: Format A |
19 | * Date: 1999 July 27 |
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-13 |
44 | * @param string $string Encoded string |
45 | * @return string $string Decoded string |
d672fcab |
46 | */ |
47 | function charset_decode_iso8859_13 ($string) { |
48 | global $default_charset; |
49 | |
50 | if (strtolower($default_charset) == 'iso-8859-13') |
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_13 = 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 | "\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" => '’' |
155 | ); |
156 | |
157 | $string = str_replace(array_keys($iso8859_13), array_values($iso8859_13), $string); |
158 | |
159 | return $string; |
160 | } |
161 | |
d6c32258 |
162 | ?> |