628144ce5d20c806c921de72b4e944c92e0667b2
[squirrelmail.git] / functions / decode / iso_8859_11.php
1 <?php
2
3 /**
4 * decode/iso8859-11.php
5 *
6 * This file contains iso-8859-11 decoding function that is needed to read
7 * iso-8859-11 encoded mails in non-iso-8859-11 locale.
8 *
9 * Original data taken from:
10 * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-11.TXT
11 *
12 * Name: ISO/IEC 8859-11:2001 to Unicode
13 * Unicode version: 3.2
14 * Table version: 1.0
15 * Table format: Format A
16 * Date: 2002 October 7
17 * Authors: Ken Whistler <kenw@sybase.com>
18 *
19 * Original copyright:
20 * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
21 *
22 * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
23 * No claims are made as to fitness for any particular purpose. No
24 * warranties of any kind are expressed or implied. The recipient
25 * agrees to determine applicability of information provided. If this
26 * file has been provided on optical media by Unicode, Inc., the sole
27 * remedy for any claim will be exchange of defective media within 90
28 * days of receipt.
29 *
30 * Unicode, Inc. hereby grants the right to freely use the information
31 * supplied in this file in the creation of products supporting the
32 * Unicode Standard, and to make copies of this file in any form for
33 * internal or external distribution as long as this notice remains
34 * attached.
35 *
36 * @copyright 2003-2016 The SquirrelMail Project Team
37 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
38 * @version $Id$
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
47 */
48 function charset_decode_iso_8859_11 ($string) {
49 // don't do decoding when there are no 8bit symbols
50 if (! sq_is8bit($string,'iso-8859-11'))
51 return $string;
52
53 $iso8859_11 = array(
54 "\xA0" => '&#160;',
55 "\xA1" => '&#3585;',
56 "\xA2" => '&#3586;',
57 "\xA3" => '&#3587;',
58 "\xA4" => '&#3588;',
59 "\xA5" => '&#3589;',
60 "\xA6" => '&#3590;',
61 "\xA7" => '&#3591;',
62 "\xA8" => '&#3592;',
63 "\xA9" => '&#3593;',
64 "\xAA" => '&#3594;',
65 "\xAB" => '&#3595;',
66 "\xAC" => '&#3596;',
67 "\xAD" => '&#3597;',
68 "\xAE" => '&#3598;',
69 "\xAF" => '&#3599;',
70 "\xB0" => '&#3600;',
71 "\xB1" => '&#3601;',
72 "\xB2" => '&#3602;',
73 "\xB3" => '&#3603;',
74 "\xB4" => '&#3604;',
75 "\xB5" => '&#3605;',
76 "\xB6" => '&#3606;',
77 "\xB7" => '&#3607;',
78 "\xB8" => '&#3608;',
79 "\xB9" => '&#3609;',
80 "\xBA" => '&#3610;',
81 "\xBB" => '&#3611;',
82 "\xBC" => '&#3612;',
83 "\xBD" => '&#3613;',
84 "\xBE" => '&#3614;',
85 "\xBF" => '&#3615;',
86 "\xC0" => '&#3616;',
87 "\xC1" => '&#3617;',
88 "\xC2" => '&#3618;',
89 "\xC3" => '&#3619;',
90 "\xC4" => '&#3620;',
91 "\xC5" => '&#3621;',
92 "\xC6" => '&#3622;',
93 "\xC7" => '&#3623;',
94 "\xC8" => '&#3624;',
95 "\xC9" => '&#3625;',
96 "\xCA" => '&#3626;',
97 "\xCB" => '&#3627;',
98 "\xCC" => '&#3628;',
99 "\xCD" => '&#3629;',
100 "\xCE" => '&#3630;',
101 "\xCF" => '&#3631;',
102 "\xD0" => '&#3632;',
103 "\xD1" => '&#3633;',
104 "\xD2" => '&#3634;',
105 "\xD3" => '&#3635;',
106 "\xD4" => '&#3636;',
107 "\xD5" => '&#3637;',
108 "\xD6" => '&#3638;',
109 "\xD7" => '&#3639;',
110 "\xD8" => '&#3640;',
111 "\xD9" => '&#3641;',
112 "\xDA" => '&#3642;',
113 "\xDF" => '&#3647;',
114 "\xE0" => '&#3648;',
115 "\xE1" => '&#3649;',
116 "\xE2" => '&#3650;',
117 "\xE3" => '&#3651;',
118 "\xE4" => '&#3652;',
119 "\xE5" => '&#3653;',
120 "\xE6" => '&#3654;',
121 "\xE7" => '&#3655;',
122 "\xE8" => '&#3656;',
123 "\xE9" => '&#3657;',
124 "\xEA" => '&#3658;',
125 "\xEB" => '&#3659;',
126 "\xEC" => '&#3660;',
127 "\xED" => '&#3661;',
128 "\xEE" => '&#3662;',
129 "\xEF" => '&#3663;',
130 "\xF0" => '&#3664;',
131 "\xF1" => '&#3665;',
132 "\xF2" => '&#3666;',
133 "\xF3" => '&#3667;',
134 "\xF4" => '&#3668;',
135 "\xF5" => '&#3669;',
136 "\xF6" => '&#3670;',
137 "\xF7" => '&#3671;',
138 "\xF8" => '&#3672;',
139 "\xF9" => '&#3673;',
140 "\xFA" => '&#3674;',
141 "\xFB" => '&#3675;'
142 );
143
144 $string = str_replace(array_keys($iso8859_11), array_values($iso8859_11), $string);
145
146 return $string;
147 }