Give compose screen the startMessage
[squirrelmail.git] / functions / decode / cp10029.php
CommitLineData
e9a71964 1<?php
d6c32258 2/**
e9a71964 3 * decode/cp10029.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 cp10029 (MacLatin2) decoding function that
10 * is needed to read cp10029 encoded mails in non-cp10029 locale.
11 *
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/LATIN2.TXT
14 *
15 * Name: cp10029_MacLatin2 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 cp10029 (MacLatin2) string
28 * @param string $string Encoded string
29 * @return string $string Decoded string
30 */
e9a71964 31function charset_decode_cp10029 ($string) {
32 global $default_charset;
33
34 if (strtolower($default_charset) == 'x-mac-centraleurroman')
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 $cp10029 = array(
43 "\0x80" => '&#196;',
44 "\0x81" => '&#256;',
45 "\0x82" => '&#257;',
46 "\0x83" => '&#201;',
47 "\0x84" => '&#260;',
48 "\0x85" => '&#214;',
49 "\0x86" => '&#220;',
50 "\0x87" => '&#225;',
51 "\0x88" => '&#261;',
52 "\0x89" => '&#268;',
53 "\0x8A" => '&#228;',
54 "\0x8B" => '&#269;',
55 "\0x8C" => '&#262;',
56 "\0x8D" => '&#263;',
57 "\0x8E" => '&#233;',
58 "\0x8F" => '&#377;',
59 "\0x90" => '&#378;',
60 "\0x91" => '&#270;',
61 "\0x92" => '&#237;',
62 "\0x93" => '&#271;',
63 "\0x94" => '&#274;',
64 "\0x95" => '&#275;',
65 "\0x96" => '&#278;',
66 "\0x97" => '&#243;',
67 "\0x98" => '&#279;',
68 "\0x99" => '&#244;',
69 "\0x9A" => '&#246;',
70 "\0x9B" => '&#245;',
71 "\0x9C" => '&#250;',
72 "\0x9D" => '&#282;',
73 "\0x9E" => '&#283;',
74 "\0x9F" => '&#252;',
75 "\0xA0" => '&#8224;',
76 "\0xA1" => '&#176;',
77 "\0xA2" => '&#280;',
78 "\0xA3" => '&#163;',
79 "\0xA4" => '&#167;',
80 "\0xA5" => '&#8226;',
81 "\0xA6" => '&#182;',
82 "\0xA7" => '&#223;',
83 "\0xA8" => '&#174;',
84 "\0xA9" => '&#169;',
85 "\0xAA" => '&#8482;',
86 "\0xAB" => '&#281;',
87 "\0xAC" => '&#168;',
88 "\0xAD" => '&#8800;',
89 "\0xAE" => '&#291;',
90 "\0xAF" => '&#302;',
91 "\0xB0" => '&#303;',
92 "\0xB1" => '&#298;',
93 "\0xB2" => '&#8804;',
94 "\0xB3" => '&#8805;',
95 "\0xB4" => '&#299;',
96 "\0xB5" => '&#310;',
97 "\0xB6" => '&#8706;',
98 "\0xB7" => '&#8721;',
99 "\0xB8" => '&#322;',
100 "\0xB9" => '&#315;',
101 "\0xBA" => '&#316;',
102 "\0xBB" => '&#317;',
103 "\0xBC" => '&#318;',
104 "\0xBD" => '&#313;',
105 "\0xBE" => '&#314;',
106 "\0xBF" => '&#325;',
107 "\0xC0" => '&#326;',
108 "\0xC1" => '&#323;',
109 "\0xC2" => '&#172;',
110 "\0xC3" => '&#8730;',
111 "\0xC4" => '&#324;',
112 "\0xC5" => '&#327;',
113 "\0xC6" => '&#8710;',
114 "\0xC7" => '&#171;',
115 "\0xC8" => '&#187;',
116 "\0xC9" => '&#8230;',
117 "\0xCA" => '&#160;',
118 "\0xCB" => '&#328;',
119 "\0xCC" => '&#336;',
120 "\0xCD" => '&#213;',
121 "\0xCE" => '&#337;',
122 "\0xCF" => '&#332;',
123 "\0xD0" => '&#8211;',
124 "\0xD1" => '&#8212;',
125 "\0xD2" => '&#8220;',
126 "\0xD3" => '&#8221;',
127 "\0xD4" => '&#8216;',
128 "\0xD5" => '&#8217;',
129 "\0xD6" => '&#247;',
130 "\0xD7" => '&#9674;',
131 "\0xD8" => '&#333;',
132 "\0xD9" => '&#340;',
133 "\0xDA" => '&#341;',
134 "\0xDB" => '&#344;',
135 "\0xDC" => '&#8249;',
136 "\0xDD" => '&#8250;',
137 "\0xDE" => '&#345;',
138 "\0xDF" => '&#342;',
139 "\0xE0" => '&#343;',
140 "\0xE1" => '&#352;',
141 "\0xE2" => '&#8218;',
142 "\0xE3" => '&#8222;',
143 "\0xE4" => '&#353;',
144 "\0xE5" => '&#346;',
145 "\0xE6" => '&#347;',
146 "\0xE7" => '&#193;',
147 "\0xE8" => '&#356;',
148 "\0xE9" => '&#357;',
149 "\0xEA" => '&#205;',
150 "\0xEB" => '&#381;',
151 "\0xEC" => '&#382;',
152 "\0xED" => '&#362;',
153 "\0xEE" => '&#211;',
154 "\0xEF" => '&#212;',
155 "\0xF0" => '&#363;',
156 "\0xF1" => '&#366;',
157 "\0xF2" => '&#218;',
158 "\0xF3" => '&#367;',
159 "\0xF4" => '&#368;',
160 "\0xF5" => '&#369;',
161 "\0xF6" => '&#370;',
162 "\0xF7" => '&#371;',
163 "\0xF8" => '&#221;',
164 "\0xF9" => '&#253;',
165 "\0xFA" => '&#311;',
166 "\0xFB" => '&#379;',
167 "\0xFC" => '&#321;',
168 "\0xFD" => '&#380;',
169 "\0xFE" => '&#290;',
170 "\0xFF" => '&#711;'
171 );
172
173 $string = str_replace(array_keys($cp10029), array_values($cp10029), $string);
174
175 return $string;
176}
d6c32258 177?>