d672fcab |
1 | <?php |
2 | /* |
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. |
38 | * |
39 | */ |
40 | function charset_decode_iso8859_8 ($string) { |
41 | global $default_charset; |
42 | |
43 | if (strtolower($default_charset) == 'iso8859-8') |
44 | return $string; |
45 | |
46 | /* Only do the slow convert if there are 8-bit characters */ |
47 | /* there is no 0x80-0x9F letters in ISO8859-* */ |
48 | if ( ! ereg("[\241-\377]", $string) ) |
49 | return $string; |
50 | |
51 | $iso8859_8 = array( |
52 | "\xA0" => ' ', |
53 | "\xA2" => '¢', |
54 | "\xA3" => '£', |
55 | "\xA4" => '¤', |
56 | "\xA5" => '¥', |
57 | "\xA6" => '¦', |
58 | "\xA7" => '§', |
59 | "\xA8" => '¨', |
60 | "\xA9" => '©', |
61 | "\xAA" => '×', |
62 | "\xAB" => '«', |
63 | "\xAC" => '¬', |
64 | "\xAD" => '­', |
65 | "\xAE" => '®', |
66 | "\xAF" => '¯', |
67 | "\xB0" => '°', |
68 | "\xB1" => '±', |
69 | "\xB2" => '²', |
70 | "\xB3" => '³', |
71 | "\xB4" => '´', |
72 | "\xB5" => 'µ', |
73 | "\xB6" => '¶', |
74 | "\xB7" => '·', |
75 | "\xB8" => '¸', |
76 | "\xB9" => '¹', |
77 | "\xBA" => '÷', |
78 | "\xBB" => '»', |
79 | "\xBC" => '¼', |
80 | "\xBD" => '½', |
81 | "\xBE" => '¾', |
82 | "\xDF" => '‗', |
83 | "\xE0" => 'א', |
84 | "\xE1" => 'ב', |
85 | "\xE2" => 'ג', |
86 | "\xE3" => 'ד', |
87 | "\xE4" => 'ה', |
88 | "\xE5" => 'ו', |
89 | "\xE6" => 'ז', |
90 | "\xE7" => 'ח', |
91 | "\xE8" => 'ט', |
92 | "\xE9" => 'י', |
93 | "\xEA" => 'ך', |
94 | "\xEB" => 'כ', |
95 | "\xEC" => 'ל', |
96 | "\xED" => 'ם', |
97 | "\xEE" => 'מ', |
98 | "\xEF" => 'ן', |
99 | "\xF0" => 'נ', |
100 | "\xF1" => 'ס', |
101 | "\xF2" => 'ע', |
102 | "\xF3" => 'ף', |
103 | "\xF4" => 'פ', |
104 | "\xF5" => 'ץ', |
105 | "\xF6" => 'צ', |
106 | "\xF7" => 'ק', |
107 | "\xF8" => 'ר', |
108 | "\xF9" => 'ש', |
109 | "\xFA" => 'ת', |
110 | "\xFD" => '‎', |
111 | "\xFE" => '‏' |
112 | ); |
113 | |
114 | $string = str_replace(array_keys($iso8859_8), array_values($iso8859_8), $string); |
115 | |
116 | return $string; |
117 | } |
118 | |
119 | ?> |