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