Replacing tabs with spaces, trimming white space at EOL and newline at EOF
[squirrelmail.git] / functions / decode / iso_8859_10.php
CommitLineData
d672fcab 1<?php
d6c32258 2/**
d672fcab 3 * decode/iso8859-10.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-10 decoding function that is needed to read
9 * iso-8859-10 encoded mails in non-iso-8859-10 locale.
91e0dccc 10 *
d672fcab 11 * Original data taken from:
12 * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-10.TXT
13 *
14 * Name: ISO/IEC 8859-10:1998 to Unicode
15 * Unicode version: 3.0
16 * Table version: 1.1
17 * Table format: Format A
18 * Date: 1999 October 11
19 * Authors: Ken Whistler <kenw@sybase.com>
20 *
21 * Original copyright:
e53c9681 22 * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
d672fcab 23 *
e53c9681 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.
d672fcab 31 *
e53c9681 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 iso-8859-10 encoded string
45 * @param string $string Encoded string
46 * @return string $string Decoded string
d672fcab 47 */
df8c4d6d 48function charset_decode_iso_8859_10 ($string) {
d672fcab 49 global $default_charset;
50
51 if (strtolower($default_charset) == 'iso-8859-10')
52 return $string;
53
e53c9681 54 // don't do decoding when there are no 8bit symbols
55 if (! sq_is8bit($string,'iso-8859-10'))
d672fcab 56 return $string;
57
58 $iso8859_10 = array(
e53c9681 59 "\xA0" => '&#160;',
60 "\xA1" => '&#260;',
61 "\xA2" => '&#274;',
62 "\xA3" => '&#290;',
63 "\xA4" => '&#298;',
64 "\xA5" => '&#296;',
65 "\xA6" => '&#310;',
66 "\xA7" => '&#167;',
67 "\xA8" => '&#315;',
68 "\xA9" => '&#272;',
69 "\xAA" => '&#352;',
70 "\xAB" => '&#358;',
71 "\xAC" => '&#381;',
72 "\xAD" => '&#173;',
73 "\xAE" => '&#362;',
74 "\xAF" => '&#330;',
75 "\xB0" => '&#176;',
76 "\xB1" => '&#261;',
77 "\xB2" => '&#275;',
78 "\xB3" => '&#291;',
79 "\xB4" => '&#299;',
80 "\xB5" => '&#297;',
81 "\xB6" => '&#311;',
82 "\xB7" => '&#183;',
83 "\xB8" => '&#316;',
84 "\xB9" => '&#273;',
85 "\xBA" => '&#353;',
86 "\xBB" => '&#359;',
87 "\xBC" => '&#382;',
88 "\xBD" => '&#8213;',
89 "\xBE" => '&#363;',
90 "\xBF" => '&#331;',
91 "\xC0" => '&#256;',
92 "\xC1" => '&#193;',
93 "\xC2" => '&#194;',
94 "\xC3" => '&#195;',
95 "\xC4" => '&#196;',
96 "\xC5" => '&#197;',
97 "\xC6" => '&#198;',
98 "\xC7" => '&#302;',
99 "\xC8" => '&#268;',
100 "\xC9" => '&#201;',
101 "\xCA" => '&#280;',
102 "\xCB" => '&#203;',
103 "\xCC" => '&#278;',
104 "\xCD" => '&#205;',
105 "\xCE" => '&#206;',
106 "\xCF" => '&#207;',
107 "\xD0" => '&#208;',
108 "\xD1" => '&#325;',
109 "\xD2" => '&#332;',
110 "\xD3" => '&#211;',
111 "\xD4" => '&#212;',
112 "\xD5" => '&#213;',
113 "\xD6" => '&#214;',
114 "\xD7" => '&#360;',
115 "\xD8" => '&#216;',
116 "\xD9" => '&#370;',
117 "\xDA" => '&#218;',
118 "\xDB" => '&#219;',
119 "\xDC" => '&#220;',
120 "\xDD" => '&#221;',
121 "\xDE" => '&#222;',
122 "\xDF" => '&#223;',
123 "\xE0" => '&#257;',
124 "\xE1" => '&#225;',
125 "\xE2" => '&#226;',
126 "\xE3" => '&#227;',
127 "\xE4" => '&#228;',
128 "\xE5" => '&#229;',
129 "\xE6" => '&#230;',
130 "\xE7" => '&#303;',
131 "\xE8" => '&#269;',
132 "\xE9" => '&#233;',
133 "\xEA" => '&#281;',
134 "\xEB" => '&#235;',
135 "\xEC" => '&#279;',
136 "\xED" => '&#237;',
137 "\xEE" => '&#238;',
138 "\xEF" => '&#239;',
139 "\xF0" => '&#240;',
140 "\xF1" => '&#326;',
141 "\xF2" => '&#333;',
142 "\xF3" => '&#243;',
143 "\xF4" => '&#244;',
144 "\xF5" => '&#245;',
145 "\xF6" => '&#246;',
146 "\xF7" => '&#361;',
147 "\xF8" => '&#248;',
148 "\xF9" => '&#371;',
149 "\xFA" => '&#250;',
150 "\xFB" => '&#251;',
151 "\xFC" => '&#252;',
152 "\xFD" => '&#253;',
153 "\xFE" => '&#254;',
154 "\xFF" => '&#312;'
d672fcab 155 );
156
157 $string = str_replace(array_keys($iso8859_10), array_values($iso8859_10), $string);
158
159 return $string;
160}
161
e53c9681 162?>