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