Preparation to begin using phpdocumentor.
[squirrelmail.git] / functions / decode / cp10006.php
CommitLineData
e9a71964 1<?php
d6c32258 2/**
e9a71964 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>
d6c32258 22 * @package squirrelmail
23 * @subpackage decode
e9a71964 24 */
25
d6c32258 26/**
27 * Decode cp10006 (MacGreek) string
28 * @param string $string String to decode
29 * @return string $string Decoded string
30 */
e9a71964 31function charset_decode_cp10006 ($string) {
32 global $default_charset;
33
34 if (strtolower($default_charset) == 'x-mac-greek')
35 return $string;
36
37 /* Only do the slow convert if there are 8-bit characters */
38 /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
39 if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) )
40 return $string;
41
42 $cp10006 = array(
43 "\0x80" => '&#196;',
44 "\0x81" => '&#185;',
45 "\0x82" => '&#178;',
46 "\0x83" => '&#201;',
47 "\0x84" => '&#179;',
48 "\0x85" => '&#214;',
49 "\0x86" => '&#220;',
50 "\0x87" => '&#901;',
51 "\0x88" => '&#224;',
52 "\0x89" => '&#226;',
53 "\0x8A" => '&#228;',
54 "\0x8B" => '&#900;',
55 "\0x8C" => '&#168;',
56 "\0x8D" => '&#231;',
57 "\0x8E" => '&#233;',
58 "\0x8F" => '&#232;',
59 "\0x90" => '&#234;',
60 "\0x91" => '&#235;',
61 "\0x92" => '&#163;',
62 "\0x93" => '&#8482;',
63 "\0x94" => '&#238;',
64 "\0x95" => '&#239;',
65 "\0x96" => '&#8226;',
66 "\0x97" => '&#189;',
67 "\0x98" => '&#8240;',
68 "\0x99" => '&#244;',
69 "\0x9A" => '&#246;',
70 "\0x9B" => '&#166;',
71 "\0x9C" => '&#173;',
72 "\0x9D" => '&#249;',
73 "\0x9E" => '&#251;',
74 "\0x9F" => '&#252;',
75 "\0xA0" => '&#8224;',
76 "\0xA1" => '&#915;',
77 "\0xA2" => '&#916;',
78 "\0xA3" => '&#920;',
79 "\0xA4" => '&#923;',
80 "\0xA5" => '&#926;',
81 "\0xA6" => '&#928;',
82 "\0xA7" => '&#223;',
83 "\0xA8" => '&#174;',
84 "\0xA9" => '&#169;',
85 "\0xAA" => '&#931;',
86 "\0xAB" => '&#938;',
87 "\0xAC" => '&#167;',
88 "\0xAD" => '&#8800;',
89 "\0xAE" => '&#176;',
90 "\0xAF" => '&#903;',
91 "\0xB0" => '&#913;',
92 "\0xB1" => '&#177;',
93 "\0xB2" => '&#8804;',
94 "\0xB3" => '&#8805;',
95 "\0xB4" => '&#165;',
96 "\0xB5" => '&#914;',
97 "\0xB6" => '&#917;',
98 "\0xB7" => '&#918;',
99 "\0xB8" => '&#919;',
100 "\0xB9" => '&#921;',
101 "\0xBA" => '&#922;',
102 "\0xBB" => '&#924;',
103 "\0xBC" => '&#934;',
104 "\0xBD" => '&#939;',
105 "\0xBE" => '&#936;',
106 "\0xBF" => '&#937;',
107 "\0xC0" => '&#940;',
108 "\0xC1" => '&#925;',
109 "\0xC2" => '&#172;',
110 "\0xC3" => '&#927;',
111 "\0xC4" => '&#929;',
112 "\0xC5" => '&#8776;',
113 "\0xC6" => '&#932;',
114 "\0xC7" => '&#171;',
115 "\0xC8" => '&#187;',
116 "\0xC9" => '&#8230;',
117 "\0xCA" => '&#160;',
118 "\0xCB" => '&#933;',
119 "\0xCC" => '&#935;',
120 "\0xCD" => '&#902;',
121 "\0xCE" => '&#904;',
122 "\0xCF" => '&#339;',
123 "\0xD0" => '&#8211;',
124 "\0xD1" => '&#8213;',
125 "\0xD2" => '&#8220;',
126 "\0xD3" => '&#8221;',
127 "\0xD4" => '&#8216;',
128 "\0xD5" => '&#8217;',
129 "\0xD6" => '&#247;',
130 "\0xD7" => '&#905;',
131 "\0xD8" => '&#906;',
132 "\0xD9" => '&#908;',
133 "\0xDA" => '&#910;',
134 "\0xDB" => '&#941;',
135 "\0xDC" => '&#942;',
136 "\0xDD" => '&#943;',
137 "\0xDE" => '&#972;',
138 "\0xDF" => '&#911;',
139 "\0xE0" => '&#973;',
140 "\0xE1" => '&#945;',
141 "\0xE2" => '&#946;',
142 "\0xE3" => '&#968;',
143 "\0xE4" => '&#948;',
144 "\0xE5" => '&#949;',
145 "\0xE6" => '&#966;',
146 "\0xE7" => '&#947;',
147 "\0xE8" => '&#951;',
148 "\0xE9" => '&#953;',
149 "\0xEA" => '&#958;',
150 "\0xEB" => '&#954;',
151 "\0xEC" => '&#955;',
152 "\0xED" => '&#956;',
153 "\0xEE" => '&#957;',
154 "\0xEF" => '&#959;',
155 "\0xF0" => '&#960;',
156 "\0xF1" => '&#974;',
157 "\0xF2" => '&#961;',
158 "\0xF3" => '&#963;',
159 "\0xF4" => '&#964;',
160 "\0xF5" => '&#952;',
161 "\0xF6" => '&#969;',
162 "\0xF7" => '&#962;',
163 "\0xF8" => '&#967;',
164 "\0xF9" => '&#965;',
165 "\0xFA" => '&#950;',
166 "\0xFB" => '&#970;',
167 "\0xFC" => '&#971;',
168 "\0xFD" => '&#912;',
169 "\0xFE" => '&#944;',
170 "\0xFF" => '&#65535;'
171 );
172
173 $string = str_replace(array_keys($cp10006), array_values($cp10006), $string);
174
175 return $string;
176}
d6c32258 177?>