Happy New Year
[squirrelmail.git] / functions / decode / iso_8859_8.php
CommitLineData
d672fcab 1<?php
4b4abf93 2
d6c32258 3/**
d672fcab 4 * decode/iso8859-8.php
d672fcab 5 *
d672fcab 6 * This file contains iso-8859-8 decoding function that is needed to read
7 * iso-8859-8 encoded mails in non-iso-8859-8 locale.
91e0dccc 8 *
d672fcab 9 * Original data taken from:
10 * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-8.TXT
11 *
12 * Name: ISO/IEC 8859-8:1999 to Unicode
13 * Unicode version: 3.0
14 * Table version: 1.1
15 * Table format: Format A
16 * Date: 2000-Jan-03
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 *
f197ec88 36 * @copyright 2003-2016 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 iso8859-8 encoded strings
45 * @param string $string Encoded string
46 * @return string $string Decoded string
d672fcab 47 */
df8c4d6d 48function charset_decode_iso_8859_8 ($string) {
e53c9681 49 // don't do decoding when there are no 8bit symbols
50 if (! sq_is8bit($string,'iso-8859-8'))
d672fcab 51 return $string;
52
53 $iso8859_8 = array(
e53c9681 54 "\xA0" => '&#160;',
55 "\xA2" => '&#162;',
56 "\xA3" => '&#163;',
57 "\xA4" => '&#164;',
58 "\xA5" => '&#165;',
59 "\xA6" => '&#166;',
60 "\xA7" => '&#167;',
61 "\xA8" => '&#168;',
62 "\xA9" => '&#169;',
63 "\xAA" => '&#215;',
64 "\xAB" => '&#171;',
65 "\xAC" => '&#172;',
66 "\xAD" => '&#173;',
67 "\xAE" => '&#174;',
68 "\xAF" => '&#175;',
69 "\xB0" => '&#176;',
70 "\xB1" => '&#177;',
71 "\xB2" => '&#178;',
72 "\xB3" => '&#179;',
73 "\xB4" => '&#180;',
74 "\xB5" => '&#181;',
75 "\xB6" => '&#182;',
76 "\xB7" => '&#183;',
77 "\xB8" => '&#184;',
78 "\xB9" => '&#185;',
79 "\xBA" => '&#247;',
80 "\xBB" => '&#187;',
81 "\xBC" => '&#188;',
82 "\xBD" => '&#189;',
83 "\xBE" => '&#190;',
84 "\xDF" => '&#8215;',
85 "\xE0" => '&#1488;',
86 "\xE1" => '&#1489;',
87 "\xE2" => '&#1490;',
88 "\xE3" => '&#1491;',
89 "\xE4" => '&#1492;',
90 "\xE5" => '&#1493;',
91 "\xE6" => '&#1494;',
92 "\xE7" => '&#1495;',
93 "\xE8" => '&#1496;',
94 "\xE9" => '&#1497;',
95 "\xEA" => '&#1498;',
96 "\xEB" => '&#1499;',
97 "\xEC" => '&#1500;',
98 "\xED" => '&#1501;',
99 "\xEE" => '&#1502;',
100 "\xEF" => '&#1503;',
101 "\xF0" => '&#1504;',
102 "\xF1" => '&#1505;',
103 "\xF2" => '&#1506;',
104 "\xF3" => '&#1507;',
105 "\xF4" => '&#1508;',
106 "\xF5" => '&#1509;',
107 "\xF6" => '&#1510;',
108 "\xF7" => '&#1511;',
109 "\xF8" => '&#1512;',
110 "\xF9" => '&#1513;',
111 "\xFA" => '&#1514;',
112 "\xFD" => '&#8206;',
113 "\xFE" => '&#8207;'
d672fcab 114 );
115
116 $string = str_replace(array_keys($iso8859_8), array_values($iso8859_8), $string);
117
118 return $string;
119}