More decoding functions
[squirrelmail.git] / functions / decode / cp1256.php
CommitLineData
211d912f 1<?php
2/*
3 * decode/cp1256.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 cp1256 decoding function that is needed to read
10 * cp1256 encoded mails in non-cp1256 locale.
11 *
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1256.TXT
14 *
15 * Name: cp1256 to Unicode table
16 * Unicode version: 2.1
17 * Table version: 2.01
18 * Table format: Format A
19 * Date: 01/5/99
20 * Contact: cpxlate@microsoft.com
21 *
22 */
23
24function charset_decode_cp1257 ($string) {
25 global $default_charset;
26
27 if (strtolower($default_charset) == 'windows-1257')
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 $cp1257 = array(
36
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;'