Today Cyrus 2.2.2-BETA with SASL Initial Client response was released so it
[squirrelmail.git] / functions / decode / cp10006.php
CommitLineData
e9a71964 1<?php
2/*
3 * decode/cp10006.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 cp10006 (MacGreek) decoding function that
10 * is needed to read cp10006 encoded mails in non-cp10006 locale.
11 *
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/GREEK.TXT
14 *
15 * Name: cp10006_MacGreek to Unicode table
16 * Unicode version: 2.0
17 * Table version: 2.00
18 * Table format: Format A
19 * Date: 04/24/96
20 * Authors: Lori Brownell <loribr@microsoft.com>
21 * K.D. Chang <a-kchang@microsoft.com>
22 */
23
24function charset_decode_cp10006 ($string) {
25 global $default_charset;
26
27 if (strtolower($default_charset) == 'x-mac-greek')
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 $cp10006 = array(
36 "\0x80" => '&#196;',
37 "\0x81" => '&#185;',
38 "\0x82" => '&#178;',
39 "\0x83" => '&#201;',
40 "\0x84" => '&#179;',
41 "\0x85" => '&#214;',
42 "\0x86" => '&#220;',
43 "\0x87" => '&#901;',
44 "\0x88" => '&#224;',
45 "\0x89" => '&#226;',
46 "\0x8A" => '&#228;',
47 "\0x8B" => '&#900;',
48 "\0x8C" => '&#168;',
49 "\0x8D" => '&#231;',
50 "\0x8E" => '&#233;',
51 "\0x8F" => '&#232;',
52 "\0x90" => '&#234;',
53 "\0x91" => '&#235;',
54 "\0x92" => '&#163;',
55 "\0x93" => '&#8482;',
56 "\0x94" => '&#238;',
57 "\0x95" => '&#239;',
58 "\0x96" => '&#8226;',
59 "\0x97" => '&#189;',
60 "\0x98" => '&#8240;',
61 "\0x99" => '&#244;',
62 "\0x9A" => '&#246;',
63 "\0x9B" => '&#166;',
64 "\0x9C" => '&#173;',
65 "\0x9D" => '&#249;',
66 "\0x9E" => '&#251;',
67 "\0x9F" => '&#252;',
68 "\0xA0" => '&#8224;',
69 "\0xA1" => '&#915;',
70 "\0xA2" => '&#916;',
71 "\0xA3" => '&#920;',
72 "\0xA4" => '&#923;',
73 "\0xA5" => '&#926;',
74 "\0xA6" => '&#928;',
75 "\0xA7" => '&#223;',
76 "\0xA8" => '&#174;',
77 "\0xA9" => '&#169;',
78 "\0xAA" => '&#931;',
79 "\0xAB" => '&#938;',
80 "\0xAC" => '&#167;',
81 "\0xAD" => '&#8800;',
82 "\0xAE" => '&#176;',
83 "\0xAF" => '&#903;',
84 "\0xB0" => '&#913;',
85 "\0xB1" => '&#177;',
86 "\0xB2" => '&#8804;',
87 "\0xB3" => '&#8805;',
88 "\0xB4" => '&#165;',
89 "\0xB5" => '&#914;',
90 "\0xB6" => '&#917;',
91 "\0xB7" => '&#918;',
92 "\0xB8" => '&#919;',
93 "\0xB9" => '&#921;',
94 "\0xBA" => '&#922;',
95 "\0xBB" => '&#924;',
96 "\0xBC" => '&#934;',
97 "\0xBD" => '&#939;',
98 "\0xBE" => '&#936;',
99 "\0xBF" => '&#937;',
100 "\0xC0" => '&#940;',
101 "\0xC1" => '&#925;',
102 "\0xC2" => '&#172;',
103 "\0xC3" => '&#927;',
104 "\0xC4" => '&#929;',
105 "\0xC5" => '&#8776;',
106 "\0xC6" => '&#932;',
107 "\0xC7" => '&#171;',
108 "\0xC8" => '&#187;',
109 "\0xC9" => '&#8230;',
110 "\0xCA" => '&#160;',
111 "\0xCB" => '&#933;',
112 "\0xCC" => '&#935;',
113 "\0xCD" => '&#902;',
114 "\0xCE" => '&#904;',
115 "\0xCF" => '&#339;',
116 "\0xD0" => '&#8211;',
117 "\0xD1" => '&#8213;',
118 "\0xD2" => '&#8220;',
119 "\0xD3" => '&#8221;',
120 "\0xD4" => '&#8216;',
121 "\0xD5" => '&#8217;',
122 "\0xD6" => '&#247;',
123 "\0xD7" => '&#905;',
124 "\0xD8" => '&#906;',
125 "\0xD9" => '&#908;',
126 "\0xDA" => '&#910;',
127 "\0xDB" => '&#941;',
128 "\0xDC" => '&#942;',
129 "\0xDD" => '&#943;',
130 "\0xDE" => '&#972;',
131 "\0xDF" => '&#911;',
132 "\0xE0" => '&#973;',
133 "\0xE1" => '&#945;',
134 "\0xE2" => '&#946;',
135 "\0xE3" => '&#968;',
136 "\0xE4" => '&#948;',
137 "\0xE5" => '&#949;',
138 "\0xE6" => '&#966;',
139 "\0xE7" => '&#947;',
140 "\0xE8" => '&#951;',
141 "\0xE9" => '&#953;',
142 "\0xEA" => '&#958;',
143 "\0xEB" => '&#954;',
144 "\0xEC" => '&#955;',
145 "\0xED" => '&#956;',
146 "\0xEE" => '&#957;',
147 "\0xEF" => '&#959;',
148 "\0xF0" => '&#960;',
149 "\0xF1" => '&#974;',
150 "\0xF2" => '&#961;',
151 "\0xF3" => '&#963;',
152 "\0xF4" => '&#964;',
153 "\0xF5" => '&#952;',
154 "\0xF6" => '&#969;',
155 "\0xF7" => '&#962;',
156 "\0xF8" => '&#967;',
157 "\0xF9" => '&#965;',
158 "\0xFA" => '&#950;',
159 "\0xFB" => '&#970;',
160 "\0xFC" => '&#971;',
161 "\0xFD" => '&#912;',
162 "\0xFE" => '&#944;',
163 "\0xFF" => '&#65535;'
164 );
165
166 $string = str_replace(array_keys($cp10006), array_values($cp10006), $string);
167
168 return $string;
169}
170?>