Allow makeInternalLink() and makeComposeLink() to accomodate access keys
[squirrelmail.git] / functions / decode / cp1256.php
1 <?php
2
3 /**
4 * decode/cp1256.php
5 *
6 * This file contains cp1256 decoding function that is needed to read
7 * cp1256 encoded mails in non-cp1256 locale.
8 *
9 * Original data taken from:
10 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1256.TXT
11 *
12 * Name: cp1256 to Unicode table
13 * Unicode version: 2.1
14 * Table version: 2.01
15 * Table format: Format A
16 * Date: 01/5/99
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 cp1256-encoded string
28 * @param string $string Encoded string
29 * @return string $string Decoded string
30 */
31 function charset_decode_cp1256 ($string) {
32 // don't do decoding when there are no 8bit symbols
33 if (! sq_is8bit($string,'windows-1256'))
34 return $string;
35
36 $cp1256 = array(
37 "\x80" => '&#8364;',
38 "\x81" => '&#1662;',
39 "\x82" => '&#8218;',
40 "\x83" => '&#402;',
41 "\x84" => '&#8222;',
42 "\x85" => '&#8230;',
43 "\x86" => '&#8224;',
44 "\x87" => '&#8225;',
45 "\x88" => '&#710;',
46 "\x89" => '&#8240;',
47 "\x8A" => '&#1657;',
48 "\x8B" => '&#8249;',
49 "\x8C" => '&#338;',
50 "\x8D" => '&#1670;',
51 "\x8E" => '&#1688;',
52 "\x8F" => '&#1672;',
53 "\x90" => '&#1711;',
54 "\x91" => '&#8216;',
55 "\x92" => '&#8217;',
56 "\x93" => '&#8220;',
57 "\x94" => '&#8221;',
58 "\x95" => '&#8226;',
59 "\x96" => '&#8211;',
60 "\x97" => '&#8212;',
61 "\x98" => '&#1705;',
62 "\x99" => '&#8482;',
63 "\x9A" => '&#1681;',
64 "\x9B" => '&#8250;',
65 "\x9C" => '&#339;',
66 "\x9D" => '&#8204;',
67 "\x9E" => '&#8205;',
68 "\x9F" => '&#1722;',
69 "\xA0" => '&#160;',
70 "\xA1" => '&#1548;',
71 "\xA2" => '&#162;',
72 "\xA3" => '&#163;',
73 "\xA4" => '&#164;',
74 "\xA5" => '&#165;',
75 "\xA6" => '&#166;',
76 "\xA7" => '&#167;',
77 "\xA8" => '&#168;',
78 "\xA9" => '&#169;',
79 "\xAA" => '&#1726;',
80 "\xAB" => '&#171;',
81 "\xAC" => '&#172;',
82 "\xAD" => '&#173;',
83 "\xAE" => '&#174;',
84 "\xAF" => '&#175;',
85 "\xB0" => '&#176;',
86 "\xB1" => '&#177;',
87 "\xB2" => '&#178;',
88 "\xB3" => '&#179;',
89 "\xB4" => '&#180;',
90 "\xB5" => '&#181;',
91 "\xB6" => '&#182;',
92 "\xB7" => '&#183;',
93 "\xB8" => '&#184;',
94 "\xB9" => '&#185;',
95 "\xBA" => '&#1563;',
96 "\xBB" => '&#187;',
97 "\xBC" => '&#188;',
98 "\xBD" => '&#189;',
99 "\xBE" => '&#190;',
100 "\xBF" => '&#1567;',
101 "\xC0" => '&#1729;',
102 "\xC1" => '&#1569;',
103 "\xC2" => '&#1570;',
104 "\xC3" => '&#1571;',
105 "\xC4" => '&#1572;',
106 "\xC5" => '&#1573;',
107 "\xC6" => '&#1574;',
108 "\xC7" => '&#1575;',
109 "\xC8" => '&#1576;',
110 "\xC9" => '&#1577;',
111 "\xCA" => '&#1578;',
112 "\xCB" => '&#1579;',
113 "\xCC" => '&#1580;',
114 "\xCD" => '&#1581;',
115 "\xCE" => '&#1582;',
116 "\xCF" => '&#1583;',
117 "\xD0" => '&#1584;',
118 "\xD1" => '&#1585;',
119 "\xD2" => '&#1586;',
120 "\xD3" => '&#1587;',
121 "\xD4" => '&#1588;',
122 "\xD5" => '&#1589;',
123 "\xD6" => '&#1590;',
124 "\xD7" => '&#215;',
125 "\xD8" => '&#1591;',
126 "\xD9" => '&#1592;',
127 "\xDA" => '&#1593;',
128 "\xDB" => '&#1594;',
129 "\xDC" => '&#1600;',
130 "\xDD" => '&#1601;',
131 "\xDE" => '&#1602;',
132 "\xDF" => '&#1603;',
133 "\xE0" => '&#224;',
134 "\xE1" => '&#1604;',
135 "\xE2" => '&#226;',
136 "\xE3" => '&#1605;',
137 "\xE4" => '&#1606;',
138 "\xE5" => '&#1607;',
139 "\xE6" => '&#1608;',
140 "\xE7" => '&#231;',
141 "\xE8" => '&#232;',
142 "\xE9" => '&#233;',
143 "\xEA" => '&#234;',
144 "\xEB" => '&#235;',
145 "\xEC" => '&#1609;',
146 "\xED" => '&#1610;',
147 "\xEE" => '&#238;',
148 "\xEF" => '&#239;',
149 "\xF0" => '&#1611;',
150 "\xF1" => '&#1612;',
151 "\xF2" => '&#1613;',
152 "\xF3" => '&#1614;',
153 "\xF4" => '&#244;',
154 "\xF5" => '&#1615;',
155 "\xF6" => '&#1616;',
156 "\xF7" => '&#247;',
157 "\xF8" => '&#1617;',
158 "\xF9" => '&#249;',
159 "\xFA" => '&#1618;',
160 "\xFB" => '&#251;',
161 "\xFC" => '&#252;',
162 "\xFD" => '&#8206;',
163 "\xFE" => '&#8207;',
164 "\xFF" => '&#1746;'
165 );
166
167 $string = str_replace(array_keys($cp1256), array_values($cp1256), $string);
168
169 return $string;
170 }