3ae3727045751b3312a0789d1c5c0d5375cca638
[squirrelmail.git] / functions / decode / iso_8859_15.php
1 <?php
2
3 /**
4 * decode/iso8859-15.php
5 *
6 * This file contains iso-8859-15 decoding function that is needed to read
7 * iso-8859-15 encoded mails in non-iso-8859-15 locale.
8 *
9 * Original data taken from:
10 * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT
11 *
12 * Name: ISO/IEC 8859-15:1999 to Unicode
13 * Unicode version: 3.0
14 * Table version: 1.0
15 * Table format: Format A
16 * Date: 1999 July 27
17 * Authors: Markus Kuhn <mkuhn@acm.org>
18 * Ken Whistler <kenw@sybase.com>
19 *
20 * Original copyright:
21 * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
22 *
23 * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
24 * No claims are made as to fitness for any particular purpose. No
25 * warranties of any kind are expressed or implied. The recipient
26 * agrees to determine applicability of information provided. If this
27 * file has been provided on optical media by Unicode, Inc., the sole
28 * remedy for any claim will be exchange of defective media within 90
29 * days of receipt.
30 *
31 * Unicode, Inc. hereby grants the right to freely use the information
32 * supplied in this file in the creation of products supporting the
33 * Unicode Standard, and to make copies of this file in any form for
34 * internal or external distribution as long as this notice remains
35 * attached.
36 *
37 * @copyright &copy; 2003-2006 The SquirrelMail Project Team
38 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
39 * @version $Id$
40 * @package squirrelmail
41 * @subpackage decode
42 */
43
44 /**
45 * Decode iso8859-15 encoded string
46 * @param string $string Encoded string
47 * @return string $string Decoded string
48 */
49 function charset_decode_iso_8859_15 ($string) {
50 // don't do decoding when there are no 8bit symbols
51 if (! sq_is8bit($string,'iso-8859-15'))
52 return $string;
53
54 $iso8859_15 = array(
55 "\xA0" => '&#160;',
56 "\xA1" => '&#161;',
57 "\xA2" => '&#162;',
58 "\xA3" => '&#163;',
59 "\xA4" => '&#8364;',
60 "\xA5" => '&#165;',
61 "\xA6" => '&#352;',
62 "\xA7" => '&#167;',
63 "\xA8" => '&#353;',
64 "\xA9" => '&#169;',
65 "\xAA" => '&#170;',
66 "\xAB" => '&#171;',
67 "\xAC" => '&#172;',
68 "\xAD" => '&#173;',
69 "\xAE" => '&#174;',
70 "\xAF" => '&#175;',
71 "\xB0" => '&#176;',
72 "\xB1" => '&#177;',
73 "\xB2" => '&#178;',
74 "\xB3" => '&#179;',
75 "\xB4" => '&#381;',
76 "\xB5" => '&#181;',
77 "\xB6" => '&#182;',
78 "\xB7" => '&#183;',
79 "\xB8" => '&#382;',
80 "\xB9" => '&#185;',
81 "\xBA" => '&#186;',
82 "\xBB" => '&#187;',
83 "\xBC" => '&#338;',
84 "\xBD" => '&#339;',
85 "\xBE" => '&#376;',
86 "\xBF" => '&#191;',
87 "\xC0" => '&#192;',
88 "\xC1" => '&#193;',
89 "\xC2" => '&#194;',
90 "\xC3" => '&#195;',
91 "\xC4" => '&#196;',
92 "\xC5" => '&#197;',
93 "\xC6" => '&#198;',
94 "\xC7" => '&#199;',
95 "\xC8" => '&#200;',
96 "\xC9" => '&#201;',
97 "\xCA" => '&#202;',
98 "\xCB" => '&#203;',
99 "\xCC" => '&#204;',
100 "\xCD" => '&#205;',
101 "\xCE" => '&#206;',
102 "\xCF" => '&#207;',
103 "\xD0" => '&#208;',
104 "\xD1" => '&#209;',
105 "\xD2" => '&#210;',
106 "\xD3" => '&#211;',
107 "\xD4" => '&#212;',
108 "\xD5" => '&#213;',
109 "\xD6" => '&#214;',
110 "\xD7" => '&#215;',
111 "\xD8" => '&#216;',
112 "\xD9" => '&#217;',
113 "\xDA" => '&#218;',
114 "\xDB" => '&#219;',
115 "\xDC" => '&#220;',
116 "\xDD" => '&#221;',
117 "\xDE" => '&#222;',
118 "\xDF" => '&#223;',
119 "\xE0" => '&#224;',
120 "\xE1" => '&#225;',
121 "\xE2" => '&#226;',
122 "\xE3" => '&#227;',
123 "\xE4" => '&#228;',
124 "\xE5" => '&#229;',
125 "\xE6" => '&#230;',
126 "\xE7" => '&#231;',
127 "\xE8" => '&#232;',
128 "\xE9" => '&#233;',
129 "\xEA" => '&#234;',
130 "\xEB" => '&#235;',
131 "\xEC" => '&#236;',
132 "\xED" => '&#237;',
133 "\xEE" => '&#238;',
134 "\xEF" => '&#239;',
135 "\xF0" => '&#240;',
136 "\xF1" => '&#241;',
137 "\xF2" => '&#242;',
138 "\xF3" => '&#243;',
139 "\xF4" => '&#244;',
140 "\xF5" => '&#245;',
141 "\xF6" => '&#246;',
142 "\xF7" => '&#247;',
143 "\xF8" => '&#248;',
144 "\xF9" => '&#249;',
145 "\xFA" => '&#250;',
146 "\xFB" => '&#251;',
147 "\xFC" => '&#252;',
148 "\xFD" => '&#253;',
149 "\xFE" => '&#254;',
150 "\xFF" => '&#255;'
151 );
152
153 $string = str_replace(array_keys($iso8859_15), array_values($iso8859_15), $string);
154
155 return $string;
156 }
157 ?>