d672fcab |
1 | <?php |
d6c32258 |
2 | /** |
d672fcab |
3 | * decode/iso8859-5.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-5 decoding function that is needed to read |
9 | * iso-8859-5 encoded mails in non-iso-8859-5 locale. |
91e0dccc |
10 | * |
d672fcab |
11 | * Original data taken from: |
12 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-5.TXT |
13 | * |
14 | * Name: ISO 8859-5: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: Ken Whistler <kenw@sybase.com> |
20 | * |
21 | * Original copyright: |
e53c9681 |
22 | * Copyright (c) 1999 Unicode, Inc. All Rights reserved. |
d672fcab |
23 | * |
e53c9681 |
24 | * This file is provided as-is by Unicode, Inc. (The Unicode Consortium). |
25 | * No claims are made as to fitness for any particular purpose. No |
26 | * warranties of any kind are expressed or implied. The recipient |
27 | * agrees to determine applicability of information provided. If this |
28 | * file has been provided on optical media by Unicode, Inc., the sole |
29 | * remedy for any claim will be exchange of defective media within 90 |
30 | * days of receipt. |
d672fcab |
31 | * |
e53c9681 |
32 | * Unicode, Inc. hereby grants the right to freely use the information |
33 | * supplied in this file in the creation of products supporting the |
34 | * Unicode Standard, and to make copies of this file in any form for |
35 | * internal or external distribution as long as this notice remains |
36 | * attached. |
31841a9e |
37 | * |
38 | * @version $Id$ |
d6c32258 |
39 | * @package squirrelmail |
40 | * @subpackage decode |
41 | */ |
42 | |
43 | /** |
44 | * Decode iso8859-5 encoded string |
45 | * @param string $string Encoded string |
46 | * @return string $string Decoded string |
d672fcab |
47 | */ |
df8c4d6d |
48 | function charset_decode_iso_8859_5 ($string) { |
d672fcab |
49 | global $default_charset; |
50 | |
51 | if (strtolower($default_charset) == 'iso-8859-5') |
52 | return $string; |
53 | |
e53c9681 |
54 | // don't do decoding when there are no 8bit symbols |
55 | if (! sq_is8bit($string,'iso-8859-5')) |
d672fcab |
56 | return $string; |
57 | |
58 | $iso8859_5 = array( |
e53c9681 |
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" => 'џ' |
d672fcab |
155 | ); |
156 | |
157 | $string = str_replace(array_keys($iso8859_5), array_values($iso8859_5), $string); |
158 | |
159 | return $string; |
160 | } |
e53c9681 |
161 | ?> |