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