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