Replacing tabs with spaces, trimming white space at EOL and newline at EOF
[squirrelmail.git] / functions / decode / cp1253.php
CommitLineData
211d912f 1<?php
d6c32258 2/**
211d912f 3 * decode/cp1253.php
211d912f 4 *
82d304a0 5 * Copyright (c) 2003-2004 The SquirrelMail Project Team
211d912f 6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * This file contains cp1253 decoding function that is needed to read
9 * cp1253 encoded mails in non-cp1253 locale.
91e0dccc 10 *
211d912f 11 * Original data taken from:
12 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1253.TXT
13 *
14 * Name: cp1253 to Unicode table
15 * Unicode version: 2.0
16 * Table version: 2.01
17 * Table format: Format A
18 * Date: 04/15/98
19 * Contact: cpxlate@microsoft.com
31841a9e 20 *
21 * @version $Id$
d6c32258 22 * @package squirrelmail
23 * @subpackage decode
211d912f 24 */
25
d6c32258 26/**
27 * Decode cp1253-encoded string
28 * @param string $string Encoded string
29 * @return string $string Decoded string
30 */
211d912f 31function charset_decode_cp1253 ($string) {
32 global $default_charset;
33
34 if (strtolower($default_charset) == 'windows-1253')
35 return $string;
36
e53c9681 37 // don't do decoding when there are no 8bit symbols
38 if (! sq_is8bit($string,'windows-1253'))
211d912f 39 return $string;
40
41 $cp1253 = array(
91e0dccc 42 "\x80" => '&#8364;',
43 "\x81" => '&#65533;',
44 "\x82" => '&#8218;',
45 "\x83" => '&#402;',
46 "\x84" => '&#8222;',
47 "\x85" => '&#8230;',
48 "\x86" => '&#8224;',
49 "\x87" => '&#8225;',
50 "\x88" => '&#65533;',
51 "\x89" => '&#8240;',
52 "\x8A" => '&#65533;',
53 "\x8B" => '&#8249;',
54 "\x8C" => '&#65533;',
55 "\x8D" => '&#65533;',
56 "\x8E" => '&#65533;',
57 "\x8F" => '&#65533;',
58 "\x90" => '&#65533;',
59 "\x91" => '&#8216;',
60 "\x92" => '&#8217;',
61 "\x93" => '&#8220;',
62 "\x94" => '&#8221;',
63 "\x95" => '&#8226;',
64 "\x96" => '&#8211;',
65 "\x97" => '&#8212;',
66 "\x98" => '&#65533;',
67 "\x99" => '&#8482;',
68 "\x9A" => '&#65533;',
69 "\x9B" => '&#8250;',
70 "\x9C" => '&#65533;',
71 "\x9D" => '&#65533;',
72 "\x9E" => '&#65533;',
73 "\x9F" => '&#65533;',
74 "\xA0" => '&#160;',
75 "\xA1" => '&#901;',
76 "\xA2" => '&#902;',
77 "\xA3" => '&#163;',
78 "\xA4" => '&#164;',
79 "\xA5" => '&#165;',
80 "\xA6" => '&#166;',
81 "\xA7" => '&#167;',
82 "\xA8" => '&#168;',
83 "\xA9" => '&#169;',
84 "\xAA" => '&#65533;',
85 "\xAB" => '&#171;',
86 "\xAC" => '&#172;',
87 "\xAD" => '&#173;',
88 "\xAE" => '&#174;',
89 "\xAF" => '&#8213;',
90 "\xB0" => '&#176;',
91 "\xB1" => '&#177;',
92 "\xB2" => '&#178;',
93 "\xB3" => '&#179;',
94 "\xB4" => '&#900;',
95 "\xB5" => '&#181;',
96 "\xB6" => '&#182;',
97 "\xB7" => '&#183;',
98 "\xB8" => '&#904;',
99 "\xB9" => '&#905;',
100 "\xBA" => '&#906;',
101 "\xBB" => '&#187;',
102 "\xBC" => '&#908;',
103 "\xBD" => '&#189;',
104 "\xBE" => '&#910;',
105 "\xBF" => '&#911;',
106 "\xC0" => '&#912;',
107 "\xC1" => '&#913;',
108 "\xC2" => '&#914;',
109 "\xC3" => '&#915;',
110 "\xC4" => '&#916;',
111 "\xC5" => '&#917;',
112 "\xC6" => '&#918;',
113 "\xC7" => '&#919;',
114 "\xC8" => '&#920;',
115 "\xC9" => '&#921;',
116 "\xCA" => '&#922;',
117 "\xCB" => '&#923;',
118 "\xCC" => '&#924;',
119 "\xCD" => '&#925;',
120 "\xCE" => '&#926;',
121 "\xCF" => '&#927;',
122 "\xD0" => '&#928;',
123 "\xD1" => '&#929;',
124 "\xD2" => '&#65533;',
125 "\xD3" => '&#931;',
126 "\xD4" => '&#932;',
127 "\xD5" => '&#933;',
128 "\xD6" => '&#934;',
129 "\xD7" => '&#935;',
130 "\xD8" => '&#936;',
131 "\xD9" => '&#937;',
132 "\xDA" => '&#938;',
133 "\xDB" => '&#939;',
134 "\xDC" => '&#940;',
135 "\xDD" => '&#941;',
136 "\xDE" => '&#942;',
137 "\xDF" => '&#943;',
138 "\xE0" => '&#944;',
139 "\xE1" => '&#945;',
140 "\xE2" => '&#946;',
141 "\xE3" => '&#947;',
142 "\xE4" => '&#948;',
143 "\xE5" => '&#949;',
144 "\xE6" => '&#950;',
145 "\xE7" => '&#951;',
146 "\xE8" => '&#952;',
147 "\xE9" => '&#953;',
148 "\xEA" => '&#954;',
149 "\xEB" => '&#955;',
150 "\xEC" => '&#956;',
151 "\xED" => '&#957;',
152 "\xEE" => '&#958;',
153 "\xEF" => '&#959;',
154 "\xF0" => '&#960;',
155 "\xF1" => '&#961;',
156 "\xF2" => '&#962;',
157 "\xF3" => '&#963;',
158 "\xF4" => '&#964;',
159 "\xF5" => '&#965;',
160 "\xF6" => '&#966;',
161 "\xF7" => '&#967;',
162 "\xF8" => '&#968;',
163 "\xF9" => '&#969;',
164 "\xFA" => '&#970;',
165 "\xFB" => '&#971;',
166 "\xFC" => '&#972;',
167 "\xFD" => '&#973;',
168 "\xFE" => '&#974;',
169 "\xFF" => '&#65533;'
211d912f 170 );
171
172 $string = str_replace(array_keys($cp1253), array_values($cp1253), $string);
173
174 return $string;
175}
176
91e0dccc 177?>