Phpdocumentor update - sed is your friend for these kinds of things ;)
[squirrelmail.git] / functions / decode / iso_8859_15.php
1 <?php
2 /**
3 * decode/iso8859-15.php
4 *
5 * Copyright (c) 2003-2004 The SquirrelMail Project Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * This file contains iso-8859-15 decoding function that is needed to read
9 * iso-8859-15 encoded mails in non-iso-8859-15 locale.
10 *
11 * Original data taken from:
12 * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT
13 *
14 * Name: ISO/IEC 8859-15:1999 to Unicode
15 * Unicode version: 3.0
16 * Table version: 1.0
17 * Table format: Format A
18 * Date: 1999 July 27
19 * Authors: Markus Kuhn <mkuhn@acm.org>
20 * 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 * @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 global $default_charset;
51
52 if (strtolower($default_charset) == 'iso-8859-15')
53 return $string;
54
55 /* Only do the slow convert if there are 8-bit characters */
56 /* there is no 0x80-0x9F letters in ISO8859-* */
57 if ( ! ereg("[\241-\377]", $string) )
58 return $string;
59
60 $iso8859_15 = array(
61 "\xA0" => '&#160;',
62 "\xA1" => '&#161;',
63 "\xA2" => '&#162;',
64 "\xA3" => '&#163;',
65 "\xA4" => '&#8364;',
66 "\xA5" => '&#165;',
67 "\xA6" => '&#352;',
68 "\xA7" => '&#167;',
69 "\xA8" => '&#353;',
70 "\xA9" => '&#169;',
71 "\xAA" => '&#170;',
72 "\xAB" => '&#171;',
73 "\xAC" => '&#172;',
74 "\xAD" => '&#173;',
75 "\xAE" => '&#174;',
76 "\xAF" => '&#175;',
77 "\xB0" => '&#176;',
78 "\xB1" => '&#177;',
79 "\xB2" => '&#178;',
80 "\xB3" => '&#179;',
81 "\xB4" => '&#381;',
82 "\xB5" => '&#181;',
83 "\xB6" => '&#182;',
84 "\xB7" => '&#183;',
85 "\xB8" => '&#382;',
86 "\xB9" => '&#185;',
87 "\xBA" => '&#186;',
88 "\xBB" => '&#187;',
89 "\xBC" => '&#338;',
90 "\xBD" => '&#339;',
91 "\xBE" => '&#376;',
92 "\xBF" => '&#191;',
93 "\xC0" => '&#192;',
94 "\xC1" => '&#193;',
95 "\xC2" => '&#194;',
96 "\xC3" => '&#195;',
97 "\xC4" => '&#196;',
98 "\xC5" => '&#197;',
99 "\xC6" => '&#198;',
100 "\xC7" => '&#199;',
101 "\xC8" => '&#200;',
102 "\xC9" => '&#201;',
103 "\xCA" => '&#202;',
104 "\xCB" => '&#203;',
105 "\xCC" => '&#204;',
106 "\xCD" => '&#205;',
107 "\xCE" => '&#206;',
108 "\xCF" => '&#207;',
109 "\xD0" => '&#208;',
110 "\xD1" => '&#209;',
111 "\xD2" => '&#210;',
112 "\xD3" => '&#211;',
113 "\xD4" => '&#212;',
114 "\xD5" => '&#213;',
115 "\xD6" => '&#214;',
116 "\xD7" => '&#215;',
117 "\xD8" => '&#216;',
118 "\xD9" => '&#217;',
119 "\xDA" => '&#218;',
120 "\xDB" => '&#219;',
121 "\xDC" => '&#220;',
122 "\xDD" => '&#221;',
123 "\xDE" => '&#222;',
124 "\xDF" => '&#223;',
125 "\xE0" => '&#224;',
126 "\xE1" => '&#225;',
127 "\xE2" => '&#226;',
128 "\xE3" => '&#227;',
129 "\xE4" => '&#228;',
130 "\xE5" => '&#229;',
131 "\xE6" => '&#230;',
132 "\xE7" => '&#231;',
133 "\xE8" => '&#232;',
134 "\xE9" => '&#233;',
135 "\xEA" => '&#234;',
136 "\xEB" => '&#235;',
137 "\xEC" => '&#236;',
138 "\xED" => '&#237;',
139 "\xEE" => '&#238;',
140 "\xEF" => '&#239;',
141 "\xF0" => '&#240;',
142 "\xF1" => '&#241;',
143 "\xF2" => '&#242;',
144 "\xF3" => '&#243;',
145 "\xF4" => '&#244;',
146 "\xF5" => '&#245;',
147 "\xF6" => '&#246;',
148 "\xF7" => '&#247;',
149 "\xF8" => '&#248;',
150 "\xF9" => '&#249;',
151 "\xFA" => '&#250;',
152 "\xFB" => '&#251;',
153 "\xFC" => '&#252;',
154 "\xFD" => '&#253;',
155 "\xFE" => '&#254;',
156 "\xFF" => '&#255;'
157 );
158
159 $string = str_replace(array_keys($iso8859_15), array_values($iso8859_15), $string);
160
161 return $string;
162 }
163
164 ?>