d672fcab |
1 | <?php |
2 | /* |
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. |
38 | * |
39 | */ |
40 | function charset_decode_iso8859_13 ($string) { |
41 | global $default_charset; |
42 | |
43 | if (strtolower($default_charset) == 'iso-8859-13') |
44 | return $string; |
45 | |
46 | /* Only do the slow convert if there are 8-bit characters */ |
47 | /* there is no 0x80-0x9F letters in ISO8859-* */ |
48 | if ( ! ereg("[\241-\377]", $string) ) |
49 | return $string; |
50 | |
51 | $iso8859_13 = array( |
52 | "\xA0" => ' ', |
53 | "\xA1" => '”', |
54 | "\xA2" => '¢', |
55 | "\xA3" => '£', |
56 | "\xA4" => '¤', |
57 | "\xA5" => '„', |
58 | "\xA6" => '¦', |
59 | "\xA7" => '§', |
60 | "\xA8" => 'Ø', |
61 | "\xA9" => '©', |
62 | "\xAA" => 'Ŗ', |
63 | "\xAB" => '«', |
64 | "\xAC" => '¬', |
65 | "\xAD" => '­', |
66 | "\xAE" => '®', |
67 | "\xAF" => 'Æ', |
68 | "\xB0" => '°', |
69 | "\xB1" => '±', |
70 | "\xB2" => '²', |
71 | "\xB3" => '³', |
72 | "\xB4" => '“', |
73 | "\xB5" => 'µ', |
74 | "\xB6" => '¶', |
75 | "\xB7" => '·', |
76 | "\xB8" => 'ø', |
77 | "\xB9" => '¹', |
78 | "\xBA" => 'ŗ', |
79 | "\xBB" => '»', |
80 | "\xBC" => '¼', |
81 | "\xBD" => '½', |
82 | "\xBE" => '¾', |
83 | "\xBF" => 'æ', |
84 | "\xC0" => 'Ą', |
85 | "\xC1" => 'Į', |
86 | "\xC2" => 'Ā', |
87 | "\xC3" => 'Ć', |
88 | "\xC4" => 'Ä', |
89 | "\xC5" => 'Å', |
90 | "\xC6" => 'Ę', |
91 | "\xC7" => 'Ē', |
92 | "\xC8" => 'Č', |
93 | "\xC9" => 'É', |
94 | "\xCA" => 'Ź', |
95 | "\xCB" => 'Ė', |
96 | "\xCC" => 'Ģ', |
97 | "\xCD" => 'Ķ', |
98 | "\xCE" => 'Ī', |
99 | "\xCF" => 'Ļ', |
100 | "\xD0" => 'Š', |
101 | "\xD1" => 'Ń', |
102 | "\xD2" => 'Ņ', |
103 | "\xD3" => 'Ó', |
104 | "\xD4" => 'Ō', |
105 | "\xD5" => 'Õ', |
106 | "\xD6" => 'Ö', |
107 | "\xD7" => '×', |
108 | "\xD8" => 'Ų', |
109 | "\xD9" => 'Ł', |
110 | "\xDA" => 'Ś', |
111 | "\xDB" => 'Ū', |
112 | "\xDC" => 'Ü', |
113 | "\xDD" => 'Ż', |
114 | "\xDE" => 'Ž', |
115 | "\xDF" => 'ß', |
116 | "\xE0" => 'ą', |
117 | "\xE1" => 'į', |
118 | "\xE2" => 'ā', |
119 | "\xE3" => 'ć', |
120 | "\xE4" => 'ä', |
121 | "\xE5" => 'å', |
122 | "\xE6" => 'ę', |
123 | "\xE7" => 'ē', |
124 | "\xE8" => 'č', |
125 | "\xE9" => 'é', |
126 | "\xEA" => 'ź', |
127 | "\xEB" => 'ė', |
128 | "\xEC" => 'ģ', |
129 | "\xED" => 'ķ', |
130 | "\xEE" => 'ī', |
131 | "\xEF" => 'ļ', |
132 | "\xF0" => 'š', |
133 | "\xF1" => 'ń', |
134 | "\xF2" => 'ņ', |
135 | "\xF3" => 'ó', |
136 | "\xF4" => 'ō', |
137 | "\xF5" => 'õ', |
138 | "\xF6" => 'ö', |
139 | "\xF7" => '÷', |
140 | "\xF8" => 'ų', |
141 | "\xF9" => 'ł', |
142 | "\xFA" => 'ś', |
143 | "\xFB" => 'ū', |
144 | "\xFC" => 'ü', |
145 | "\xFD" => 'ż', |
146 | "\xFE" => 'ž', |
147 | "\xFF" => '’' |
148 | ); |
149 | |
150 | $string = str_replace(array_keys($iso8859_13), array_values($iso8859_13), $string); |
151 | |
152 | return $string; |
153 | } |
154 | |
155 | ?> |