d672fcab |
1 | <?php |
d6c32258 |
2 | /** |
d672fcab |
3 | * decode/iso8859-8.php |
4 | * $Id$ |
5 | * |
0a708025 |
6 | * Copyright (c) 2003 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 |
47 | function 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" => ' ', |
60 | "\xA2" => '¢', |
61 | "\xA3" => '£', |
62 | "\xA4" => '¤', |
63 | "\xA5" => '¥', |
64 | "\xA6" => '¦', |
65 | "\xA7" => '§', |
66 | "\xA8" => '¨', |
67 | "\xA9" => '©', |
68 | "\xAA" => '×', |
69 | "\xAB" => '«', |
70 | "\xAC" => '¬', |
71 | "\xAD" => '­', |
72 | "\xAE" => '®', |
73 | "\xAF" => '¯', |
74 | "\xB0" => '°', |
75 | "\xB1" => '±', |
76 | "\xB2" => '²', |
77 | "\xB3" => '³', |
78 | "\xB4" => '´', |
79 | "\xB5" => 'µ', |
80 | "\xB6" => '¶', |
81 | "\xB7" => '·', |
82 | "\xB8" => '¸', |
83 | "\xB9" => '¹', |
84 | "\xBA" => '÷', |
85 | "\xBB" => '»', |
86 | "\xBC" => '¼', |
87 | "\xBD" => '½', |
88 | "\xBE" => '¾', |
89 | "\xDF" => '‗', |
90 | "\xE0" => 'א', |
91 | "\xE1" => 'ב', |
92 | "\xE2" => 'ג', |
93 | "\xE3" => 'ד', |
94 | "\xE4" => 'ה', |
95 | "\xE5" => 'ו', |
96 | "\xE6" => 'ז', |
97 | "\xE7" => 'ח', |
98 | "\xE8" => 'ט', |
99 | "\xE9" => 'י', |
100 | "\xEA" => 'ך', |
101 | "\xEB" => 'כ', |
102 | "\xEC" => 'ל', |
103 | "\xED" => 'ם', |
104 | "\xEE" => 'מ', |
105 | "\xEF" => 'ן', |
106 | "\xF0" => 'נ', |
107 | "\xF1" => 'ס', |
108 | "\xF2" => 'ע', |
109 | "\xF3" => 'ף', |
110 | "\xF4" => 'פ', |
111 | "\xF5" => 'ץ', |
112 | "\xF6" => 'צ', |
113 | "\xF7" => 'ק', |
114 | "\xF8" => 'ר', |
115 | "\xF9" => 'ש', |
116 | "\xFA" => 'ת', |
117 | "\xFD" => '‎', |
118 | "\xFE" => '‏' |
119 | ); |
120 | |
121 | $string = str_replace(array_keys($iso8859_8), array_values($iso8859_8), $string); |
122 | |
123 | return $string; |
124 | } |
125 | |
d6c32258 |
126 | ?> |