Fix for Outlook html mail with a defined background color and no text color.
[squirrelmail.git] / functions / decode / iso-ir-111.php
CommitLineData
0e4337e7 1<?php
2/*
3 * decode/iso-ir-111.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 iso-ir-111 decoding function that is needed to read
10 * iso-ir-111 encoded mails in non-iso-ir-111 locale.
11 *
12 * Original data taken from:
13 * http://crl.nmsu.edu/~mleisher/csets/ISOIR111.TXT
14 *
15 * Original ID: Id: ISOIR111.TXT,v 1.2 1999/08/23 18:34:15 mleisher Exp
16 * Name: ISO IR 111/ECMA Cyrillic to Unicode 2.1 mapping table.
17 * Typed in by hand from
18 * http://www.fingertipsoft.com/ref/cyrillic/charsets.html
19 * Author: Mark Leisher <mleisher@crl.nmsu.edu>
20 * Date: 05 March 1998
21 *
22 * Original copyright:
23 * Copyright 1999 Computing Research Labs, New Mexico State University
24 *
25 * Permission is hereby granted, free of charge, to any person obtaining a
26 * copy of this software and associated documentation files (the ""Software""),
27 * to deal in the Software without restriction, including without limitation
28 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
29 * and/or sell copies of the Software, and to permit persons to whom the
30 * Software is furnished to do so, subject to the following conditions:
31 *
32 * The above copyright notice and this permission notice shall be included in
33 * all copies or substantial portions of the Software.
34 *
35 * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
38 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
39 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
40 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
41 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */
43
44function charset_decode_iso_ir_111 ($string) {
45 global $default_charset;
46
47 if (strtolower($default_charset) == 'iso-ir-111')
48 return $string;
49
50 /* Only do the slow convert if there are 8-bit characters */
51 /* there is no 0x80-0x9F letters in ISO-IR-111 */
52 if ( ! ereg("[\241-\377]", $string) )
53 return $string;
54
55 $iso_ir_111 = array(
56 "\xA0" => '&#160;',
57 "\xA1" => '&#1106;',
58 "\xA2" => '&#1107;',
59 "\xA3" => '&#1105;',
60 "\xA4" => '&#1108;',
61 "\xA5" => '&#1109;',
62 "\xA6" => '&#1110;',
63 "\xA7" => '&#1111;',
64 "\xA8" => '&#1112;',
65 "\xA9" => '&#1113;',
66 "\xAA" => '&#1114;',
67 "\xAB" => '&#1115;',
68 "\xAC" => '&#1116;',
69 "\xAD" => '&#173;',
70 "\xAE" => '&#1118;',
71 "\xAF" => '&#1119;',
72 "\xB0" => '&#8470;',
73 "\xB1" => '&#1026;',
74 "\xB2" => '&#1027;',
75 "\xB3" => '&#1025;',
76 "\xB4" => '&#1028;',
77 "\xB5" => '&#1029;',
78 "\xB6" => '&#1030;',
79 "\xB7" => '&#1031;',
80 "\xB8" => '&#1032;',
81 "\xB9" => '&#1033;',
82 "\xBA" => '&#1034;',
83 "\xBB" => '&#1035;',
84 "\xBC" => '&#1036;',
85 "\xBD" => '&#164;',
86 "\xBE" => '&#1038;',
87 "\xBF" => '&#1039;',
88 "\xC0" => '&#1102;',
89 "\xC1" => '&#1072;',
90 "\xC2" => '&#1073;',
91 "\xC3" => '&#1094;',
92 "\xC4" => '&#1076;',
93 "\xC5" => '&#1077;',
94 "\xC6" => '&#1092;',
95 "\xC7" => '&#1075;',
96 "\xC8" => '&#1093;',
97 "\xC9" => '&#1080;',
98 "\xCA" => '&#1081;',
99 "\xCB" => '&#1082;',
100 "\xCC" => '&#1083;',
101 "\xCD" => '&#1084;',
102 "\xCE" => '&#1085;',
103 "\xCF" => '&#1086;',
104 "\xD0" => '&#1087;',
105 "\xD1" => '&#1103;',
106 "\xD2" => '&#1088;',
107 "\xD3" => '&#1089;',
108 "\xD4" => '&#1090;',
109 "\xD5" => '&#1091;',
110 "\xD6" => '&#1078;',
111 "\xD7" => '&#1074;',
112 "\xD8" => '&#1100;',
113 "\xD9" => '&#1099;',
114 "\xDA" => '&#1079;',
115 "\xDB" => '&#1096;',
116 "\xDC" => '&#1101;',
117 "\xDD" => '&#1097;',
118 "\xDE" => '&#1095;',
119 "\xDF" => '&#1098;',
120 "\xE0" => '&#1070;',
121 "\xE1" => '&#1040;',
122 "\xE2" => '&#1041;',
123 "\xE3" => '&#1062;',
124 "\xE4" => '&#1044;',
125 "\xE5" => '&#1045;',
126 "\xE6" => '&#1060;',
127 "\xE7" => '&#1043;',
128 "\xE8" => '&#1061;',
129 "\xE9" => '&#1048;',
130 "\xEA" => '&#1049;',
131 "\xEB" => '&#1050;',
132 "\xEC" => '&#1051;',
133 "\xED" => '&#1052;',
134 "\xEE" => '&#1053;',
135 "\xEF" => '&#1054;',
136 "\xF0" => '&#1055;',
137 "\xF1" => '&#1071;',
138 "\xF2" => '&#1056;',
139 "\xF3" => '&#1057;',
140 "\xF4" => '&#1058;',
141 "\xF5" => '&#1059;',
142 "\xF6" => '&#1046;',
143 "\xF7" => '&#1042;',
144 "\xF8" => '&#1068;',
145 "\xF9" => '&#1067;',
146 "\xFA" => '&#1047;',
147 "\xFB" => '&#1064;',
148 "\xFC" => '&#1069;',
149 "\xFD" => '&#1065;',
150 "\xFE" => '&#1063;',
151 "\xFF" => '&#1066;'
152 );
153
154 $string = str_replace(array_keys($iso_ir_111), array_values($iso_ir_111), $string);
155
156 return $string;
157}
158
159?>