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