Replacing tabs with spaces, trimming white space at EOL and newline at EOF
[squirrelmail.git] / functions / decode / cp1250.php
CommitLineData
211d912f 1<?php
d6c32258 2/**
211d912f 3 * decode/cp1250.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 cp1250 decoding function that is needed to read
9 * cp1250 encoded mails in non-cp1250 locale.
91e0dccc 10 *
211d912f 11 * Original data taken from:
12 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT
13 *
14 * Name: cp1250 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 a cp1250 string
28 * @param string $string Encoded string
29 * @return string $string Decoded string
30 */
211d912f 31function charset_decode_cp1250 ($string) {
32 global $default_charset;
33
34 if (strtolower($default_charset) == 'windows-1250')
35 return $string;
36
e53c9681 37 // don't do decoding when there are no 8bit symbols
38 if (! sq_is8bit($string,'windows-1250'))
211d912f 39 return $string;
40
41 $cp1250 = array(
91e0dccc 42 "\x80" => '&#8364;',
43 "\x81" => '&#65533;',
44 "\x82" => '&#8218;',
45 "\x83" => '&#65533;',
46 "\x84" => '&#8222;',
47 "\x85" => '&#8230;',
48 "\x86" => '&#8224;',
49 "\x87" => '&#8225;',
50 "\x88" => '&#65533;',
51 "\x89" => '&#8240;',
52 "\x8A" => '&#352;',
53 "\x8B" => '&#8249;',
54 "\x8C" => '&#346;',
55 "\x8D" => '&#356;',
56 "\x8E" => '&#381;',
57 "\x8F" => '&#377;',
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" => '&#353;',
69 "\x9B" => '&#8250;',
70 "\x9C" => '&#347;',
71 "\x9D" => '&#357;',
72 "\x9E" => '&#382;',
73 "\x9F" => '&#378;',
74 "\xA0" => '&#160;',
75 "\xA1" => '&#711;',
76 "\xA2" => '&#728;',
77 "\xA3" => '&#321;',
78 "\xA4" => '&#164;',
79 "\xA5" => '&#260;',
80 "\xA6" => '&#166;',
81 "\xA7" => '&#167;',
82 "\xA8" => '&#168;',
83 "\xA9" => '&#169;',
84 "\xAA" => '&#350;',
85 "\xAB" => '&#171;',
86 "\xAC" => '&#172;',
87 "\xAD" => '&#173;',
88 "\xAE" => '&#174;',
89 "\xAF" => '&#379;',
90 "\xB0" => '&#176;',
91 "\xB1" => '&#177;',
92 "\xB2" => '&#731;',
93 "\xB3" => '&#322;',
94 "\xB4" => '&#180;',
95 "\xB5" => '&#181;',
96 "\xB6" => '&#182;',
97 "\xB7" => '&#183;',
98 "\xB8" => '&#184;',
99 "\xB9" => '&#261;',
100 "\xBA" => '&#351;',
101 "\xBB" => '&#187;',
102 "\xBC" => '&#317;',
103 "\xBD" => '&#733;',
104 "\xBE" => '&#318;',
105 "\xBF" => '&#380;',
106 "\xC0" => '&#340;',
107 "\xC1" => '&#193;',
108 "\xC2" => '&#194;',
109 "\xC3" => '&#258;',
110 "\xC4" => '&#196;',
111 "\xC5" => '&#313;',
112 "\xC6" => '&#262;',
113 "\xC7" => '&#199;',
114 "\xC8" => '&#268;',
115 "\xC9" => '&#201;',
116 "\xCA" => '&#280;',
117 "\xCB" => '&#203;',
118 "\xCC" => '&#282;',
119 "\xCD" => '&#205;',
120 "\xCE" => '&#206;',
121 "\xCF" => '&#270;',
122 "\xD0" => '&#272;',
123 "\xD1" => '&#323;',
124 "\xD2" => '&#327;',
125 "\xD3" => '&#211;',
126 "\xD4" => '&#212;',
127 "\xD5" => '&#336;',
128 "\xD6" => '&#214;',
129 "\xD7" => '&#215;',
130 "\xD8" => '&#344;',
131 "\xD9" => '&#366;',
132 "\xDA" => '&#218;',
133 "\xDB" => '&#368;',
134 "\xDC" => '&#220;',
135 "\xDD" => '&#221;',
136 "\xDE" => '&#354;',
137 "\xDF" => '&#223;',
138 "\xE0" => '&#341;',
139 "\xE1" => '&#225;',
140 "\xE2" => '&#226;',
141 "\xE3" => '&#259;',
142 "\xE4" => '&#228;',
143 "\xE5" => '&#314;',
144 "\xE6" => '&#263;',
145 "\xE7" => '&#231;',
146 "\xE8" => '&#269;',
147 "\xE9" => '&#233;',
148 "\xEA" => '&#281;',
149 "\xEB" => '&#235;',
150 "\xEC" => '&#283;',
151 "\xED" => '&#237;',
152 "\xEE" => '&#238;',
153 "\xEF" => '&#271;',
154 "\xF0" => '&#273;',
155 "\xF1" => '&#324;',
156 "\xF2" => '&#328;',
157 "\xF3" => '&#243;',
158 "\xF4" => '&#244;',
159 "\xF5" => '&#337;',
160 "\xF6" => '&#246;',
161 "\xF7" => '&#247;',
162 "\xF8" => '&#345;',
163 "\xF9" => '&#367;',
164 "\xFA" => '&#250;',
165 "\xFB" => '&#369;',
166 "\xFC" => '&#252;',
167 "\xFD" => '&#253;',
168 "\xFE" => '&#355;',
169 "\xFF" => '&#729;'
211d912f 170 );
171
172 $string = str_replace(array_keys($cp1250), array_values($cp1250), $string);
173
174 return $string;
175}
176
91e0dccc 177?>