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