d672fcab |
1 | <?php |
4b4abf93 |
2 | |
d6c32258 |
3 | /** |
d672fcab |
4 | * decode/iso8859-3.php |
d672fcab |
5 | * |
d672fcab |
6 | * This file contains iso-8859-3 decoding function that is needed to read |
7 | * iso-8859-3 encoded mails in non-iso-8859-3 locale. |
91e0dccc |
8 | * |
d672fcab |
9 | * Original data taken from: |
10 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-3.TXT |
11 | * |
12 | * Name: ISO/IEC 8859-3:1999 to Unicode |
13 | * Unicode version: 3.0 |
14 | * Table version: 1.0 |
15 | * Table format: Format A |
16 | * Date: 1999 July 27 |
17 | * Authors: Ken Whistler <kenw@sybase.com> |
18 | * |
19 | * Original copyright: |
e53c9681 |
20 | * Copyright (c) 1999 Unicode, Inc. All Rights reserved. |
d672fcab |
21 | * |
e53c9681 |
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 | * |
e53c9681 |
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 | * |
c0d96801 |
36 | * @copyright 2003-2012 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-3 encoded string |
45 | * @param string $string Encoded string |
46 | * @return string $string Decoded string |
d672fcab |
47 | */ |
df8c4d6d |
48 | function charset_decode_iso_8859_3 ($string) { |
e53c9681 |
49 | // don't do decoding when there are no 8bit symbols |
50 | if (! sq_is8bit($string,'iso-8859-3')) |
d672fcab |
51 | return $string; |
52 | |
53 | $iso8859_3 = array( |
e53c9681 |
54 | "\xA0" => ' ', |
55 | "\xA1" => 'Ħ', |
56 | "\xA2" => '˘', |
57 | "\xA3" => '£', |
58 | "\xA4" => '¤', |
59 | "\xA6" => 'Ĥ', |
60 | "\xA7" => '§', |
61 | "\xA8" => '¨', |
62 | "\xA9" => 'İ', |
63 | "\xAA" => 'Ş', |
64 | "\xAB" => 'Ğ', |
65 | "\xAC" => 'Ĵ', |
66 | "\xAD" => '­', |
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 | "\xBF" => 'ż', |
83 | "\xC0" => 'À', |
84 | "\xC1" => 'Á', |
85 | "\xC2" => 'Â', |
86 | "\xC4" => 'Ä', |
87 | "\xC5" => 'Ċ', |
88 | "\xC6" => 'Ĉ', |
89 | "\xC7" => 'Ç', |
90 | "\xC8" => 'È', |
91 | "\xC9" => 'É', |
92 | "\xCA" => 'Ê', |
93 | "\xCB" => 'Ë', |
94 | "\xCC" => 'Ì', |
95 | "\xCD" => 'Í', |
96 | "\xCE" => 'Î', |
97 | "\xCF" => 'Ï', |
98 | "\xD1" => 'Ñ', |
99 | "\xD2" => 'Ò', |
100 | "\xD3" => 'Ó', |
101 | "\xD4" => 'Ô', |
102 | "\xD5" => 'Ġ', |
103 | "\xD6" => 'Ö', |
104 | "\xD7" => '×', |
105 | "\xD8" => 'Ĝ', |
106 | "\xD9" => 'Ù', |
107 | "\xDA" => 'Ú', |
108 | "\xDB" => 'Û', |
109 | "\xDC" => 'Ü', |
110 | "\xDD" => 'Ŭ', |
111 | "\xDE" => 'Ŝ', |
112 | "\xDF" => 'ß', |
113 | "\xE0" => 'à', |
114 | "\xE1" => 'á', |
115 | "\xE2" => 'â', |
116 | "\xE4" => 'ä', |
117 | "\xE5" => 'ċ', |
118 | "\xE6" => 'ĉ', |
119 | "\xE7" => 'ç', |
120 | "\xE8" => 'è', |
121 | "\xE9" => 'é', |
122 | "\xEA" => 'ê', |
123 | "\xEB" => 'ë', |
124 | "\xEC" => 'ì', |
125 | "\xED" => 'í', |
126 | "\xEE" => 'î', |
127 | "\xEF" => 'ï', |
128 | "\xF1" => 'ñ', |
129 | "\xF2" => 'ò', |
130 | "\xF3" => 'ó', |
131 | "\xF4" => 'ô', |
132 | "\xF5" => 'ġ', |
133 | "\xF6" => 'ö', |
134 | "\xF7" => '÷', |
135 | "\xF8" => 'ĝ', |
136 | "\xF9" => 'ù', |
137 | "\xFA" => 'ú', |
138 | "\xFB" => 'û', |
139 | "\xFC" => 'ü', |
140 | "\xFD" => 'ŭ', |
141 | "\xFE" => 'ŝ', |
142 | "\xFF" => '˙' |
d672fcab |
143 | ); |
144 | |
145 | $string = str_replace(array_keys($iso8859_3), array_values($iso8859_3), $string); |
146 | |
147 | return $string; |
148 | } |