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