0e4337e7 |
1 | <?php |
4b4abf93 |
2 | |
d6c32258 |
3 | /** |
0e4337e7 |
4 | * decode/iso-ir-111.php |
0e4337e7 |
5 | * |
0e4337e7 |
6 | * This file contains iso-ir-111 decoding function that is needed to read |
7 | * iso-ir-111 encoded mails in non-iso-ir-111 locale. |
91e0dccc |
8 | * |
0e4337e7 |
9 | * Original data taken from: |
10 | * http://crl.nmsu.edu/~mleisher/csets/ISOIR111.TXT |
11 | * |
91e0dccc |
12 | * Original ID: Id: ISOIR111.TXT,v 1.2 1999/08/23 18:34:15 mleisher Exp |
0e4337e7 |
13 | * Name: ISO IR 111/ECMA Cyrillic to Unicode 2.1 mapping table. |
91e0dccc |
14 | * Typed in by hand from |
0e4337e7 |
15 | * http://www.fingertipsoft.com/ref/cyrillic/charsets.html |
16 | * Author: Mark Leisher <mleisher@crl.nmsu.edu> |
17 | * Date: 05 March 1998 |
18 | * |
19 | * Original copyright: |
20 | * Copyright 1999 Computing Research Labs, New Mexico State University |
91e0dccc |
21 | * |
0e4337e7 |
22 | * Permission is hereby granted, free of charge, to any person obtaining a |
23 | * copy of this software and associated documentation files (the ""Software""), |
24 | * to deal in the Software without restriction, including without limitation |
25 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
26 | * and/or sell copies of the Software, and to permit persons to whom the |
27 | * Software is furnished to do so, subject to the following conditions: |
91e0dccc |
28 | * |
0e4337e7 |
29 | * The above copyright notice and this permission notice shall be included in |
30 | * all copies or substantial portions of the Software. |
91e0dccc |
31 | * |
0e4337e7 |
32 | * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
33 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
34 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
35 | * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY |
36 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT |
37 | * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR |
38 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
d6c32258 |
39 | * |
8ed19238 |
40 | * @copyright 2003-2019 The SquirrelMail Project Team |
4b4abf93 |
41 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
31841a9e |
42 | * @version $Id$ |
d6c32258 |
43 | * @package squirrelmail |
44 | * @subpackage decode |
0e4337e7 |
45 | */ |
46 | |
d6c32258 |
47 | /** |
48 | * Decode iso-ir-111 encoded strings |
49 | * @param string $string Encoded string |
50 | * @return string Decoded string |
51 | */ |
0e4337e7 |
52 | function charset_decode_iso_ir_111 ($string) { |
e53c9681 |
53 | // don't do decoding when there are no 8bit symbols |
54 | if (! sq_is8bit($string,'iso-ir-111')) |
0e4337e7 |
55 | return $string; |
56 | |
57 | $iso_ir_111 = array( |
e53c9681 |
58 | "\xA0" => ' ', |
59 | "\xA1" => 'ђ', |
60 | "\xA2" => 'ѓ', |
61 | "\xA3" => 'ё', |
62 | "\xA4" => 'є', |
63 | "\xA5" => 'ѕ', |
64 | "\xA6" => 'і', |
65 | "\xA7" => 'ї', |
66 | "\xA8" => 'ј', |
67 | "\xA9" => 'љ', |
68 | "\xAA" => 'њ', |
69 | "\xAB" => 'ћ', |
70 | "\xAC" => 'ќ', |
71 | "\xAD" => '­', |
72 | "\xAE" => 'ў', |
73 | "\xAF" => 'џ', |
74 | "\xB0" => '№', |
75 | "\xB1" => 'Ђ', |
76 | "\xB2" => 'Ѓ', |
77 | "\xB3" => 'Ё', |
78 | "\xB4" => 'Є', |
79 | "\xB5" => 'Ѕ', |
80 | "\xB6" => 'І', |
81 | "\xB7" => 'Ї', |
82 | "\xB8" => 'Ј', |
83 | "\xB9" => 'Љ', |
84 | "\xBA" => 'Њ', |
85 | "\xBB" => 'Ћ', |
86 | "\xBC" => 'Ќ', |
87 | "\xBD" => '¤', |
88 | "\xBE" => 'Ў', |
89 | "\xBF" => 'Џ', |
90 | "\xC0" => 'ю', |
91 | "\xC1" => 'а', |
92 | "\xC2" => 'б', |
93 | "\xC3" => 'ц', |
94 | "\xC4" => 'д', |
95 | "\xC5" => 'е', |
96 | "\xC6" => 'ф', |
97 | "\xC7" => 'г', |
98 | "\xC8" => 'х', |
99 | "\xC9" => 'и', |
100 | "\xCA" => 'й', |
101 | "\xCB" => 'к', |
102 | "\xCC" => 'л', |
103 | "\xCD" => 'м', |
104 | "\xCE" => 'н', |
105 | "\xCF" => 'о', |
106 | "\xD0" => 'п', |
107 | "\xD1" => 'я', |
108 | "\xD2" => 'р', |
109 | "\xD3" => 'с', |
110 | "\xD4" => 'т', |
111 | "\xD5" => 'у', |
112 | "\xD6" => 'ж', |
113 | "\xD7" => 'в', |
114 | "\xD8" => 'ь', |
115 | "\xD9" => 'ы', |
116 | "\xDA" => 'з', |
117 | "\xDB" => 'ш', |
118 | "\xDC" => 'э', |
119 | "\xDD" => 'щ', |
120 | "\xDE" => 'ч', |
121 | "\xDF" => 'ъ', |
122 | "\xE0" => 'Ю', |
123 | "\xE1" => 'А', |
124 | "\xE2" => 'Б', |
125 | "\xE3" => 'Ц', |
126 | "\xE4" => 'Д', |
127 | "\xE5" => 'Е', |
128 | "\xE6" => 'Ф', |
129 | "\xE7" => 'Г', |
130 | "\xE8" => 'Х', |
131 | "\xE9" => 'И', |
132 | "\xEA" => 'Й', |
133 | "\xEB" => 'К', |
134 | "\xEC" => 'Л', |
135 | "\xED" => 'М', |
136 | "\xEE" => 'Н', |
137 | "\xEF" => 'О', |
138 | "\xF0" => 'П', |
139 | "\xF1" => 'Я', |
140 | "\xF2" => 'Р', |
141 | "\xF3" => 'С', |
142 | "\xF4" => 'Т', |
143 | "\xF5" => 'У', |
144 | "\xF6" => 'Ж', |
145 | "\xF7" => 'В', |
146 | "\xF8" => 'Ь', |
147 | "\xF9" => 'Ы', |
148 | "\xFA" => 'З', |
149 | "\xFB" => 'Ш', |
150 | "\xFC" => 'Э', |
151 | "\xFD" => 'Щ', |
152 | "\xFE" => 'Ч', |
153 | "\xFF" => 'Ъ' |
0e4337e7 |
154 | ); |
155 | |
156 | $string = str_replace(array_keys($iso_ir_111), array_values($iso_ir_111), $string); |
157 | |
158 | return $string; |
159 | } |