Move HTML output from compose.php to templates. Also fixes broken send functionality...
[squirrelmail.git] / functions / decode / cp1251.php
CommitLineData
211d912f 1<?php
4b4abf93 2
d6c32258 3/**
211d912f 4 * decode/cp1251.php
211d912f 5 *
211d912f 6 * This file contains cp1251 decoding function that is needed to read
7 * cp1251 encoded mails in non-cp1251 locale.
91e0dccc 8 *
211d912f 9 * Original data taken from:
10 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT
11 *
12 * Name: cp1251 to Unicode table
13 * Unicode version: 2.0
14 * Table version: 2.01
15 * Table format: Format A
16 * Date: 04/15/98
17 * Contact: cpxlate@microsoft.com
31841a9e 18 *
47ccfad4 19 * @copyright &copy; 2003-2006 The SquirrelMail Project Team
4b4abf93 20 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
31841a9e 21 * @version $Id$
d6c32258 22 * @package squirrelmail
23 * @subpackage decode
211d912f 24 */
25
d6c32258 26/**
27 * Decode cp1251-encoded string
28 * @param string $string Encoded string
29 * @return string $string Decoded string
30 */
211d912f 31function charset_decode_cp1251 ($string) {
e53c9681 32 // don't do decoding when there are no 8bit symbols
33 if (! sq_is8bit($string,'windows-1251'))
211d912f 34 return $string;
35
36 $cp1251 = array(
91e0dccc 37 "\x80" => '&#1026;',
38 "\x81" => '&#1027;',
39 "\x82" => '&#8218;',
40 "\x83" => '&#1107;',
41 "\x84" => '&#8222;',
42 "\x85" => '&#8230;',
43 "\x86" => '&#8224;',
44 "\x87" => '&#8225;',
45 "\x88" => '&#8364;',
46 "\x89" => '&#8240;',
47 "\x8A" => '&#1033;',
48 "\x8B" => '&#8249;',
49 "\x8C" => '&#1034;',
50 "\x8D" => '&#1036;',
51 "\x8E" => '&#1035;',
52 "\x8F" => '&#1039;',
53 "\x90" => '&#1106;',
54 "\x91" => '&#8216;',
55 "\x92" => '&#8217;',
56 "\x93" => '&#8220;',
57 "\x94" => '&#8221;',
58 "\x95" => '&#8226;',
59 "\x96" => '&#8211;',
60 "\x97" => '&#8212;',
61 "\x98" => '&#65533;',
62 "\x99" => '&#8482;',
63 "\x9A" => '&#1113;',
64 "\x9B" => '&#8250;',
65 "\x9C" => '&#1114;',
66 "\x9D" => '&#1116;',
67 "\x9E" => '&#1115;',
68 "\x9F" => '&#1119;',
69 "\xA0" => '&#160;',
70 "\xA1" => '&#1038;',
71 "\xA2" => '&#1118;',
72 "\xA3" => '&#1032;',
73 "\xA4" => '&#164;',
74 "\xA5" => '&#1168;',
75 "\xA6" => '&#166;',
76 "\xA7" => '&#167;',
77 "\xA8" => '&#1025;',
78 "\xA9" => '&#169;',
79 "\xAA" => '&#1028;',
80 "\xAB" => '&#171;',
81 "\xAC" => '&#172;',
82 "\xAD" => '&#173;',
83 "\xAE" => '&#174;',
84 "\xAF" => '&#1031;',
85 "\xB0" => '&#176;',
86 "\xB1" => '&#177;',
87 "\xB2" => '&#1030;',
88 "\xB3" => '&#1110;',
89 "\xB4" => '&#1169;',
90 "\xB5" => '&#181;',
91 "\xB6" => '&#182;',
92 "\xB7" => '&#183;',
93 "\xB8" => '&#1105;',
94 "\xB9" => '&#8470;',
95 "\xBA" => '&#1108;',
96 "\xBB" => '&#187;',
97 "\xBC" => '&#1112;',
98 "\xBD" => '&#1029;',
99 "\xBE" => '&#1109;',
100 "\xBF" => '&#1111;',
101 "\xC0" => '&#1040;',
102 "\xC1" => '&#1041;',
103 "\xC2" => '&#1042;',
104 "\xC3" => '&#1043;',
105 "\xC4" => '&#1044;',
106 "\xC5" => '&#1045;',
107 "\xC6" => '&#1046;',
108 "\xC7" => '&#1047;',
109 "\xC8" => '&#1048;',
110 "\xC9" => '&#1049;',
111 "\xCA" => '&#1050;',
112 "\xCB" => '&#1051;',
113 "\xCC" => '&#1052;',
114 "\xCD" => '&#1053;',
115 "\xCE" => '&#1054;',
116 "\xCF" => '&#1055;',
117 "\xD0" => '&#1056;',
118 "\xD1" => '&#1057;',
119 "\xD2" => '&#1058;',
120 "\xD3" => '&#1059;',
121 "\xD4" => '&#1060;',
122 "\xD5" => '&#1061;',
123 "\xD6" => '&#1062;',
124 "\xD7" => '&#1063;',
125 "\xD8" => '&#1064;',
126 "\xD9" => '&#1065;',
127 "\xDA" => '&#1066;',
128 "\xDB" => '&#1067;',
129 "\xDC" => '&#1068;',
130 "\xDD" => '&#1069;',
131 "\xDE" => '&#1070;',
132 "\xDF" => '&#1071;',
133 "\xE0" => '&#1072;',
134 "\xE1" => '&#1073;',
135 "\xE2" => '&#1074;',
136 "\xE3" => '&#1075;',
137 "\xE4" => '&#1076;',
138 "\xE5" => '&#1077;',
139 "\xE6" => '&#1078;',
140 "\xE7" => '&#1079;',
141 "\xE8" => '&#1080;',
142 "\xE9" => '&#1081;',
143 "\xEA" => '&#1082;',
144 "\xEB" => '&#1083;',
145 "\xEC" => '&#1084;',
146 "\xED" => '&#1085;',
147 "\xEE" => '&#1086;',
148 "\xEF" => '&#1087;',
149 "\xF0" => '&#1088;',
150 "\xF1" => '&#1089;',
151 "\xF2" => '&#1090;',
152 "\xF3" => '&#1091;',
153 "\xF4" => '&#1092;',
154 "\xF5" => '&#1093;',
155 "\xF6" => '&#1094;',
156 "\xF7" => '&#1095;',
157 "\xF8" => '&#1096;',
158 "\xF9" => '&#1097;',
159 "\xFA" => '&#1098;',
160 "\xFB" => '&#1099;',
161 "\xFC" => '&#1100;',
162 "\xFD" => '&#1101;',
163 "\xFE" => '&#1102;',
164 "\xFF" => '&#1103;'
211d912f 165 );
166
167 $string = str_replace(array_keys($cp1251), array_values($cp1251), $string);
168
169 return $string;
170}