Give compose screen the startMessage
[squirrelmail.git] / functions / decode / cp10007.php
1 <?php
2 /**
3 * decode/cp10007.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 cp10007 (MacCyrillic) decoding function that
10 * is needed to read cp10007 encoded mails in non-cp10007 locale.
11 *
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/CYRILLIC.TXT
14 *
15 * Name: cp10007_MacCyrillic 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 * @package squirrelmail
23 * @subpackage decode
24 */
25
26 /**
27 * Decode cp10007 (MacCyrillic) string
28 * @param string $string MacCyrillic string to decode
29 * @return string $string Decoded string
30 */
31 function charset_decode_cp10007 ($string) {
32 global $default_charset;
33
34 if (strtolower($default_charset) == 'x-mac-cyrillic')
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 $cp10007 = array(
43 "\x80" => '&#1040;',
44 "\x81" => '&#1041;',
45 "\x82" => '&#1042;',
46 "\x83" => '&#1043;',
47 "\x84" => '&#1044;',
48 "\x85" => '&#1045;',
49 "\x86" => '&#1046;',
50 "\x87" => '&#1047;',
51 "\x88" => '&#1048;',
52 "\x89" => '&#1049;',
53 "\x8A" => '&#1050;',
54 "\x8B" => '&#1051;',
55 "\x8C" => '&#1052;',
56 "\x8D" => '&#1053;',
57 "\x8E" => '&#1054;',
58 "\x8F" => '&#1055;',
59 "\x90" => '&#1056;',
60 "\x91" => '&#1057;',
61 "\x92" => '&#1058;',
62 "\x93" => '&#1059;',
63 "\x94" => '&#1060;',
64 "\x95" => '&#1061;',
65 "\x96" => '&#1062;',
66 "\x97" => '&#1063;',
67 "\x98" => '&#1064;',
68 "\x99" => '&#1065;',
69 "\x9A" => '&#1066;',
70 "\x9B" => '&#1067;',
71 "\x9C" => '&#1068;',
72 "\x9D" => '&#1069;',
73 "\x9E" => '&#1070;',
74 "\x9F" => '&#1071;',
75 "\xA0" => '&#8224;',
76 "\xA1" => '&#176;',
77 "\xA2" => '&#162;',
78 "\xA3" => '&#163;',
79 "\xA4" => '&#167;',
80 "\xA5" => '&#8226;',
81 "\xA6" => '&#182;',
82 "\xA7" => '&#1030;',
83 "\xA8" => '&#174;',
84 "\xA9" => '&#169;',
85 "\xAA" => '&#8482;',
86 "\xAB" => '&#1026;',
87 "\xAC" => '&#1106;',
88 "\xAD" => '&#8800;',
89 "\xAE" => '&#1027;',
90 "\xAF" => '&#1107;',
91 "\xB0" => '&#8734;',
92 "\xB1" => '&#177;',
93 "\xB2" => '&#8804;',
94 "\xB3" => '&#8805;',
95 "\xB4" => '&#1110;',
96 "\xB5" => '&#181;',
97 "\xB6" => '&#8706;',
98 "\xB7" => '&#1032;',
99 "\xB8" => '&#1028;',
100 "\xB9" => '&#1108;',
101 "\xBA" => '&#1031;',
102 "\xBB" => '&#1111;',
103 "\xBC" => '&#1033;',
104 "\xBD" => '&#1113;',
105 "\xBE" => '&#1034;',
106 "\xBF" => '&#1114;',
107 "\xC0" => '&#1112;',
108 "\xC1" => '&#1029;',
109 "\xC2" => '&#172;',
110 "\xC3" => '&#8730;',
111 "\xC4" => '&#402;',
112 "\xC5" => '&#8776;',
113 "\xC6" => '&#8710;',
114 "\xC7" => '&#171;',
115 "\xC8" => '&#187;',
116 "\xC9" => '&#8230;',
117 "\xCA" => '&#160;',
118 "\xCB" => '&#1035;',
119 "\xCC" => '&#1115;',
120 "\xCD" => '&#1036;',
121 "\xCE" => '&#1116;',
122 "\xCF" => '&#1109;',
123 "\xD0" => '&#8211;',
124 "\xD1" => '&#8212;',
125 "\xD2" => '&#8220;',
126 "\xD3" => '&#8221;',
127 "\xD4" => '&#8216;',
128 "\xD5" => '&#8217;',
129 "\xD6" => '&#247;',
130 "\xD7" => '&#8222;',
131 "\xD8" => '&#1038;',
132 "\xD9" => '&#1118;',
133 "\xDA" => '&#1039;',
134 "\xDB" => '&#1119;',
135 "\xDC" => '&#8470;',
136 "\xDD" => '&#1025;',
137 "\xDE" => '&#1105;',
138 "\xDF" => '&#1103;',
139 "\xE0" => '&#1072;',
140 "\xE1" => '&#1073;',
141 "\xE2" => '&#1074;',
142 "\xE3" => '&#1075;',
143 "\xE4" => '&#1076;',
144 "\xE5" => '&#1077;',
145 "\xE6" => '&#1078;',
146 "\xE7" => '&#1079;',
147 "\xE8" => '&#1080;',
148 "\xE9" => '&#1081;',
149 "\xEA" => '&#1082;',
150 "\xEB" => '&#1083;',
151 "\xEC" => '&#1084;',
152 "\xED" => '&#1085;',
153 "\xEE" => '&#1086;',
154 "\xEF" => '&#1087;',
155 "\xF0" => '&#1088;',
156 "\xF1" => '&#1089;',
157 "\xF2" => '&#1090;',
158 "\xF3" => '&#1091;',
159 "\xF4" => '&#1092;',
160 "\xF5" => '&#1093;',
161 "\xF6" => '&#1094;',
162 "\xF7" => '&#1095;',
163 "\xF8" => '&#1096;',
164 "\xF9" => '&#1097;',
165 "\xFA" => '&#1098;',
166 "\xFB" => '&#1099;',
167 "\xFC" => '&#1100;',
168 "\xFD" => '&#1101;',
169 "\xFE" => '&#1102;',
170 "\xFF" => '&#164;'
171 );
172
173 $string = str_replace(array_keys($cp10007), array_values($cp10007), $string);
174
175 return $string;
176 }
177 ?>