fixed warning
[squirrelmail.git] / functions / decode / iso8859-11.php
CommitLineData
d672fcab 1<?php
2/*
3 * decode/iso8859-11.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-11 decoding function that is needed to read
10 * iso-8859-11 encoded mails in non-iso-8859-11 locale.
11 *
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-11.TXT
14 *
15 * Name: ISO/IEC 8859-11:2001 to Unicode
16 * Unicode version: 3.2
17 * Table version: 1.0
18 * Table format: Format A
19 * Date: 2002 October 7
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_11 ($string) {
41 global $default_charset;
42
43 if (strtolower($default_charset) == 'iso-8859-11')
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_11 = array(
52 "\xA0" => '&#160;',
53 "\xA1" => '&#3585;',
54 "\xA2" => '&#3586;',
55 "\xA3" => '&#3587;',
56 "\xA4" => '&#3588;',
57 "\xA5" => '&#3589;',
58 "\xA6" => '&#3590;',
59 "\xA7" => '&#3591;',
60 "\xA8" => '&#3592;',
61 "\xA9" => '&#3593;',
62 "\xAA" => '&#3594;',
63 "\xAB" => '&#3595;',
64 "\xAC" => '&#3596;',
65 "\xAD" => '&#3597;',
66 "\xAE" => '&#3598;',
67 "\xAF" => '&#3599;',
68 "\xB0" => '&#3600;',
69 "\xB1" => '&#3601;',
70 "\xB2" => '&#3602;',
71 "\xB3" => '&#3603;',
72 "\xB4" => '&#3604;',
73 "\xB5" => '&#3605;',
74 "\xB6" => '&#3606;',
75 "\xB7" => '&#3607;',
76 "\xB8" => '&#3608;',
77 "\xB9" => '&#3609;',
78 "\xBA" => '&#3610;',
79 "\xBB" => '&#3611;',
80 "\xBC" => '&#3612;',
81 "\xBD" => '&#3613;',
82 "\xBE" => '&#3614;',
83 "\xBF" => '&#3615;',
84 "\xC0" => '&#3616;',
85 "\xC1" => '&#3617;',
86 "\xC2" => '&#3618;',
87 "\xC3" => '&#3619;',
88 "\xC4" => '&#3620;',
89 "\xC5" => '&#3621;',
90 "\xC6" => '&#3622;',
91 "\xC7" => '&#3623;',
92 "\xC8" => '&#3624;',
93 "\xC9" => '&#3625;',
94 "\xCA" => '&#3626;',
95 "\xCB" => '&#3627;',
96 "\xCC" => '&#3628;',
97 "\xCD" => '&#3629;',
98 "\xCE" => '&#3630;',
99 "\xCF" => '&#3631;',
100 "\xD0" => '&#3632;',
101 "\xD1" => '&#3633;',
102 "\xD2" => '&#3634;',
103 "\xD3" => '&#3635;',
104 "\xD4" => '&#3636;',
105 "\xD5" => '&#3637;',
106 "\xD6" => '&#3638;',
107 "\xD7" => '&#3639;',
108 "\xD8" => '&#3640;',
109 "\xD9" => '&#3641;',
110 "\xDA" => '&#3642;',
111 "\xDF" => '&#3647;',
112 "\xE0" => '&#3648;',
113 "\xE1" => '&#3649;',
114 "\xE2" => '&#3650;',
115 "\xE3" => '&#3651;',
116 "\xE4" => '&#3652;',
117 "\xE5" => '&#3653;',
118 "\xE6" => '&#3654;',
119 "\xE7" => '&#3655;',
120 "\xE8" => '&#3656;',
121 "\xE9" => '&#3657;',
122 "\xEA" => '&#3658;',
123 "\xEB" => '&#3659;',
124 "\xEC" => '&#3660;',
125 "\xED" => '&#3661;',
126 "\xEE" => '&#3662;',
127 "\xEF" => '&#3663;',
128 "\xF0" => '&#3664;',
129 "\xF1" => '&#3665;',
130 "\xF2" => '&#3666;',
131 "\xF3" => '&#3667;',
132 "\xF4" => '&#3668;',
133 "\xF5" => '&#3669;',
134 "\xF6" => '&#3670;',
135 "\xF7" => '&#3671;',
136 "\xF8" => '&#3672;',
137 "\xF9" => '&#3673;',
138 "\xFA" => '&#3674;',
139 "\xFB" => '&#3675;'
140 );
141
142 $string = str_replace(array_keys($iso8859_11), array_values($iso8859_11), $string);
143
144 return $string;
145}
146
147?>