d672fcab |
1 | <?php |
d6c32258 |
2 | /** |
d672fcab |
3 | * decode/iso8859-7.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-7 decoding function that is needed to read |
10 | * iso-8859-7 encoded mails in non-iso-8859-7 locale. |
11 | * |
12 | * Original data taken from: |
13 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT |
14 | * |
15 | * Name: ISO 8859-7:1987 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-7 encoded strings |
44 | * @param string $string Encoded string |
45 | * @return string $string Decoded string |
d672fcab |
46 | */ |
df8c4d6d |
47 | function charset_decode_iso_8859_7 ($string) { |
d672fcab |
48 | global $default_charset; |
49 | |
50 | if (strtolower($default_charset) == 'iso-8859-7') |
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_7 = array( |
59 | "\xA0" => ' ', |
60 | "\xA1" => '‘', |
61 | "\xA2" => '’', |
62 | "\xA3" => '£', |
63 | "\xA6" => '¦', |
64 | "\xA7" => '§', |
65 | "\xA8" => '¨', |
66 | "\xA9" => '©', |
67 | "\xAB" => '«', |
68 | "\xAC" => '¬', |
69 | "\xAD" => '­', |
70 | "\xAF" => '―', |
71 | "\xB0" => '°', |
72 | "\xB1" => '±', |
73 | "\xB2" => '²', |
74 | "\xB3" => '³', |
75 | "\xB4" => '΄', |
76 | "\xB5" => '΅', |
77 | "\xB6" => 'Ά', |
78 | "\xB7" => '·', |
79 | "\xB8" => 'Έ', |
80 | "\xB9" => 'Ή', |
81 | "\xBA" => 'Ί', |
82 | "\xBB" => '»', |
83 | "\xBC" => 'Ό', |
84 | "\xBD" => '½', |
85 | "\xBE" => 'Ύ', |
86 | "\xBF" => 'Ώ', |
87 | "\xC0" => 'ΐ', |
88 | "\xC1" => 'Α', |
89 | "\xC2" => 'Β', |
90 | "\xC3" => 'Γ', |
91 | "\xC4" => 'Δ', |
92 | "\xC5" => 'Ε', |
93 | "\xC6" => 'Ζ', |
94 | "\xC7" => 'Η', |
95 | "\xC8" => 'Θ', |
96 | "\xC9" => 'Ι', |
97 | "\xCA" => 'Κ', |
98 | "\xCB" => 'Λ', |
99 | "\xCC" => 'Μ', |
100 | "\xCD" => 'Ν', |
101 | "\xCE" => 'Ξ', |
102 | "\xCF" => 'Ο', |
103 | "\xD0" => 'Π', |
104 | "\xD1" => 'Ρ', |
105 | "\xD3" => 'Σ', |
106 | "\xD4" => 'Τ', |
107 | "\xD5" => 'Υ', |
108 | "\xD6" => 'Φ', |
109 | "\xD7" => 'Χ', |
110 | "\xD8" => 'Ψ', |
111 | "\xD9" => 'Ω', |
112 | "\xDA" => 'Ϊ', |
113 | "\xDB" => 'Ϋ', |
114 | "\xDC" => 'ά', |
115 | "\xDD" => 'έ', |
116 | "\xDE" => 'ή', |
117 | "\xDF" => 'ί', |
118 | "\xE0" => 'ΰ', |
119 | "\xE1" => 'α', |
120 | "\xE2" => 'β', |
121 | "\xE3" => 'γ', |
122 | "\xE4" => 'δ', |
123 | "\xE5" => 'ε', |
124 | "\xE6" => 'ζ', |
125 | "\xE7" => 'η', |
126 | "\xE8" => 'θ', |
127 | "\xE9" => 'ι', |
128 | "\xEA" => 'κ', |
129 | "\xEB" => 'λ', |
130 | "\xEC" => 'μ', |
131 | "\xED" => 'ν', |
132 | "\xEE" => 'ξ', |
133 | "\xEF" => 'ο', |
134 | "\xF0" => 'π', |
135 | "\xF1" => 'ρ', |
136 | "\xF2" => 'ς', |
137 | "\xF3" => 'σ', |
138 | "\xF4" => 'τ', |
139 | "\xF5" => 'υ', |
140 | "\xF6" => 'φ', |
141 | "\xF7" => 'χ', |
142 | "\xF8" => 'ψ', |
143 | "\xF9" => 'ω', |
144 | "\xFA" => 'ϊ', |
145 | "\xFB" => 'ϋ', |
146 | "\xFC" => 'ό', |
147 | "\xFD" => 'ύ', |
148 | "\xFE" => 'ώ' |
149 | ); |
150 | |
151 | $string = str_replace(array_keys($iso8859_7), array_values($iso8859_7), $string); |
152 | |
153 | return $string; |
154 | } |
155 | |
d6c32258 |
156 | ?> |