Be a bit more verbose in the error message about PEAR not being included:
[squirrelmail.git] / functions / decode / iso_8859_7.php
1 <?php
2 /**
3 * decode/iso8859-7.php
4 *
5 * Copyright (c) 2003-2004 The SquirrelMail Project Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * This file contains iso-8859-7 decoding function that is needed to read
9 * iso-8859-7 encoded mails in non-iso-8859-7 locale.
10 *
11 * Original data taken from:
12 * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT
13 *
14 * Name: ISO 8859-7:1987 to Unicode
15 * Unicode version: 3.0
16 * Table version: 1.0
17 * Table format: Format A
18 * Date: 1999 July 27
19 * Authors: Ken Whistler <kenw@sybase.com>
20 *
21 * Original copyright:
22 * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
23 *
24 * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
25 * No claims are made as to fitness for any particular purpose. No
26 * warranties of any kind are expressed or implied. The recipient
27 * agrees to determine applicability of information provided. If this
28 * file has been provided on optical media by Unicode, Inc., the sole
29 * remedy for any claim will be exchange of defective media within 90
30 * days of receipt.
31 *
32 * Unicode, Inc. hereby grants the right to freely use the information
33 * supplied in this file in the creation of products supporting the
34 * Unicode Standard, and to make copies of this file in any form for
35 * internal or external distribution as long as this notice remains
36 * attached.
37 *
38 * @version $Id$
39 * @package squirrelmail
40 * @subpackage decode
41 */
42
43 /**
44 * Decode iso8859-7 encoded strings
45 * @param string $string Encoded string
46 * @return string $string Decoded string
47 */
48 function charset_decode_iso_8859_7 ($string) {
49 global $default_charset;
50
51 if (strtolower($default_charset) == 'iso-8859-7')
52 return $string;
53
54 /* Only do the slow convert if there are 8-bit characters */
55 /* there is no 0x80-0x9F letters in ISO8859-* */
56 if ( ! ereg("[\241-\377]", $string) )
57 return $string;
58
59 $iso8859_7 = array(
60 "\xA0" => '&#160;',
61 "\xA1" => '&#8216;',
62 "\xA2" => '&#8217;',
63 "\xA3" => '&#163;',
64 "\xA6" => '&#166;',
65 "\xA7" => '&#167;',
66 "\xA8" => '&#168;',
67 "\xA9" => '&#169;',
68 "\xAB" => '&#171;',
69 "\xAC" => '&#172;',
70 "\xAD" => '&#173;',
71 "\xAF" => '&#8213;',
72 "\xB0" => '&#176;',
73 "\xB1" => '&#177;',
74 "\xB2" => '&#178;',
75 "\xB3" => '&#179;',
76 "\xB4" => '&#900;',
77 "\xB5" => '&#901;',
78 "\xB6" => '&#902;',
79 "\xB7" => '&#183;',
80 "\xB8" => '&#904;',
81 "\xB9" => '&#905;',
82 "\xBA" => '&#906;',
83 "\xBB" => '&#187;',
84 "\xBC" => '&#908;',
85 "\xBD" => '&#189;',
86 "\xBE" => '&#910;',
87 "\xBF" => '&#911;',
88 "\xC0" => '&#912;',
89 "\xC1" => '&#913;',
90 "\xC2" => '&#914;',
91 "\xC3" => '&#915;',
92 "\xC4" => '&#916;',
93 "\xC5" => '&#917;',
94 "\xC6" => '&#918;',
95 "\xC7" => '&#919;',
96 "\xC8" => '&#920;',
97 "\xC9" => '&#921;',
98 "\xCA" => '&#922;',
99 "\xCB" => '&#923;',
100 "\xCC" => '&#924;',
101 "\xCD" => '&#925;',
102 "\xCE" => '&#926;',
103 "\xCF" => '&#927;',
104 "\xD0" => '&#928;',
105 "\xD1" => '&#929;',
106 "\xD3" => '&#931;',
107 "\xD4" => '&#932;',
108 "\xD5" => '&#933;',
109 "\xD6" => '&#934;',
110 "\xD7" => '&#935;',
111 "\xD8" => '&#936;',
112 "\xD9" => '&#937;',
113 "\xDA" => '&#938;',
114 "\xDB" => '&#939;',
115 "\xDC" => '&#940;',
116 "\xDD" => '&#941;',
117 "\xDE" => '&#942;',
118 "\xDF" => '&#943;',
119 "\xE0" => '&#944;',
120 "\xE1" => '&#945;',
121 "\xE2" => '&#946;',
122 "\xE3" => '&#947;',
123 "\xE4" => '&#948;',
124 "\xE5" => '&#949;',
125 "\xE6" => '&#950;',
126 "\xE7" => '&#951;',
127 "\xE8" => '&#952;',
128 "\xE9" => '&#953;',
129 "\xEA" => '&#954;',
130 "\xEB" => '&#955;',
131 "\xEC" => '&#956;',
132 "\xED" => '&#957;',
133 "\xEE" => '&#958;',
134 "\xEF" => '&#959;',
135 "\xF0" => '&#960;',
136 "\xF1" => '&#961;',
137 "\xF2" => '&#962;',
138 "\xF3" => '&#963;',
139 "\xF4" => '&#964;',
140 "\xF5" => '&#965;',
141 "\xF6" => '&#966;',
142 "\xF7" => '&#967;',
143 "\xF8" => '&#968;',
144 "\xF9" => '&#969;',
145 "\xFA" => '&#970;',
146 "\xFB" => '&#971;',
147 "\xFC" => '&#972;',
148 "\xFD" => '&#973;',
149 "\xFE" => '&#974;'
150 );
151
152 $string = str_replace(array_keys($iso8859_7), array_values($iso8859_7), $string);
153
154 return $string;
155 }
156
157 ?>