Today Cyrus 2.2.2-BETA with SASL Initial Client response was released so it
[squirrelmail.git] / functions / decode / cp1258.php
CommitLineData
211d912f 1<?php
2/*
3 * decode/cp1258.php
4 * $Id$
5 *
6 * Copyright (c) 2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This file contains cp1258 decoding function that is needed to read
10 * cp1258 encoded mails in non-cp1258 locale.
11 *
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1258.TXT
14 *
15 * Name: cp1258 to Unicode table
16 * Unicode version: 2.0
17 * Table version: 2.01
18 * Table format: Format A
19 * Date: 04/15/98
20 * Contact: cpxlate@microsoft.com
21 *
22 */
23
24function charset_decode_cp1258 ($string) {
25 global $default_charset;
26
27 if (strtolower($default_charset) == 'windows-1258')
28 return $string;
29
30 /* Only do the slow convert if there are 8-bit characters */
31 /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
32 if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) )
33 return $string;
34
35 $cp1258 = array(
36 "\x80" => '&#8364;',
37 "\x81" => '&#65533;',
38 "\x82" => '&#8218;',
39 "\x83" => '&#402;',
40 "\x84" => '&#8222;',
41 "\x85" => '&#8230;',
42 "\x86" => '&#8224;',
43 "\x87" => '&#8225;',
44 "\x88" => '&#710;',
45 "\x89" => '&#8240;',
46 "\x8A" => '&#65533;',
47 "\x8B" => '&#8249;',
48 "\x8C" => '&#338;',
49 "\x8D" => '&#65533;',
50 "\x8E" => '&#65533;',
51 "\x8F" => '&#65533;',
52 "\x90" => '&#65533;',
53 "\x91" => '&#8216;',
54 "\x92" => '&#8217;',
55 "\x93" => '&#8220;',
56 "\x94" => '&#8221;',
57 "\x95" => '&#8226;',
58 "\x96" => '&#8211;',
59 "\x97" => '&#8212;',
60 "\x98" => '&#732;',
61 "\x99" => '&#8482;',
62 "\x9A" => '&#65533;',
63 "\x9B" => '&#8250;',
64 "\x9C" => '&#339;',
65 "\x9D" => '&#65533;',
66 "\x9E" => '&#65533;',
67 "\x9F" => '&#376;',
68 "\xA0" => '&#160;',
69 "\xA1" => '&#161;',
70 "\xA2" => '&#162;',
71 "\xA3" => '&#163;',
72 "\xA4" => '&#164;',
73 "\xA5" => '&#165;',
74 "\xA6" => '&#166;',
75 "\xA7" => '&#167;',
76 "\xA8" => '&#168;',
77 "\xA9" => '&#169;',
78 "\xAA" => '&#170;',
79 "\xAB" => '&#171;',
80 "\xAC" => '&#172;',
81 "\xAD" => '&#173;',
82 "\xAE" => '&#174;',
83 "\xAF" => '&#175;',
84 "\xB0" => '&#176;',
85 "\xB1" => '&#177;',
86 "\xB2" => '&#178;',
87 "\xB3" => '&#179;',
88 "\xB4" => '&#180;',
89 "\xB5" => '&#181;',
90 "\xB6" => '&#182;',
91 "\xB7" => '&#183;',
92 "\xB8" => '&#184;',
93 "\xB9" => '&#185;',
94 "\xBA" => '&#186;',
95 "\xBB" => '&#187;',
96 "\xBC" => '&#188;',
97 "\xBD" => '&#189;',
98 "\xBE" => '&#190;',
99 "\xBF" => '&#191;',
100 "\xC0" => '&#192;',
101 "\xC1" => '&#193;',
102 "\xC2" => '&#194;',
103 "\xC3" => '&#258;',
104 "\xC4" => '&#196;',
105 "\xC5" => '&#197;',
106 "\xC6" => '&#198;',
107 "\xC7" => '&#199;',
108 "\xC8" => '&#200;',
109 "\xC9" => '&#201;',
110 "\xCA" => '&#202;',
111 "\xCB" => '&#203;',
112 "\xCC" => '&#768;',
113 "\xCD" => '&#205;',
114 "\xCE" => '&#206;',
115 "\xCF" => '&#207;',
116 "\xD0" => '&#272;',
117 "\xD1" => '&#209;',
118 "\xD2" => '&#777;',
119 "\xD3" => '&#211;',
120 "\xD4" => '&#212;',
121 "\xD5" => '&#416;',
122 "\xD6" => '&#214;',
123 "\xD7" => '&#215;',
124 "\xD8" => '&#216;',
125 "\xD9" => '&#217;',
126 "\xDA" => '&#218;',
127 "\xDB" => '&#219;',
128 "\xDC" => '&#220;',
129 "\xDD" => '&#431;',
130 "\xDE" => '&#771;',
131 "\xDF" => '&#223;',
132 "\xE0" => '&#224;',
133 "\xE1" => '&#225;',
134 "\xE2" => '&#226;',
135 "\xE3" => '&#259;',
136 "\xE4" => '&#228;',
137 "\xE5" => '&#229;',
138 "\xE6" => '&#230;',
139 "\xE7" => '&#231;',
140 "\xE8" => '&#232;',
141 "\xE9" => '&#233;',
142 "\xEA" => '&#234;',
143 "\xEB" => '&#235;',
144 "\xEC" => '&#769;',
145 "\xED" => '&#237;',
146 "\xEE" => '&#238;',
147 "\xEF" => '&#239;',
148 "\xF0" => '&#273;',
149 "\xF1" => '&#241;',
150 "\xF2" => '&#803;',
151 "\xF3" => '&#243;',
152 "\xF4" => '&#244;',
153 "\xF5" => '&#417;',
154 "\xF6" => '&#246;',
155 "\xF7" => '&#247;',
156 "\xF8" => '&#248;',
157 "\xF9" => '&#249;',
158 "\xFA" => '&#250;',
159 "\xFB" => '&#251;',
160 "\xFC" => '&#252;',
161 "\xFD" => '&#432;',
162 "\xFE" => '&#8363;',
163 "\xFF" => '&#255;'
164 );
165
166 $string = str_replace(array_keys($cp1258), array_values($cp1258), $string);
167
168 return $string;
169}
170
171?>