d672fcab |
1 | <?php |
d6c32258 |
2 | /** |
d672fcab |
3 | * decode/iso8859-6.php |
d672fcab |
4 | * |
6c84ba1e |
5 | * Copyright (c) 2003-2005 The SquirrelMail Project Team |
d672fcab |
6 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
7 | * |
8 | * This file contains iso-8859-6 decoding function that is needed to read |
9 | * iso-8859-6 encoded mails in non-iso-8859-6 locale. |
91e0dccc |
10 | * |
d672fcab |
11 | * Original data taken from: |
12 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-6.TXT |
13 | * |
14 | * Name: ISO 8859-6:1999 to Unicode |
15 | * Unicode version: 3.0 |
16 | * Table version: 1.0 |
17 | * Table format: Format A |
18 | * Date: 1999 July 27 |
19 | * Authors: Ken Whistler <kenw@sybase.com> |
20 | * |
21 | * Original copyright: |
e53c9681 |
22 | * Copyright (c) 1999 Unicode, Inc. All Rights reserved. |
d672fcab |
23 | * |
e53c9681 |
24 | * This file is provided as-is by Unicode, Inc. (The Unicode Consortium). |
25 | * No claims are made as to fitness for any particular purpose. No |
26 | * warranties of any kind are expressed or implied. The recipient |
27 | * agrees to determine applicability of information provided. If this |
28 | * file has been provided on optical media by Unicode, Inc., the sole |
29 | * remedy for any claim will be exchange of defective media within 90 |
30 | * days of receipt. |
d672fcab |
31 | * |
e53c9681 |
32 | * Unicode, Inc. hereby grants the right to freely use the information |
33 | * supplied in this file in the creation of products supporting the |
34 | * Unicode Standard, and to make copies of this file in any form for |
35 | * internal or external distribution as long as this notice remains |
36 | * attached. |
31841a9e |
37 | * |
38 | * @version $Id$ |
d6c32258 |
39 | * @package squirrelmail |
40 | * @subpackage decode |
41 | */ |
42 | |
43 | /** |
44 | * Decode iso8859-6 strings |
45 | * @param string $string Encoded string |
46 | * @return string $string Decoded string |
d672fcab |
47 | */ |
df8c4d6d |
48 | function charset_decode_iso_8859_6 ($string) { |
e53c9681 |
49 | // don't do decoding when there are no 8bit symbols |
50 | if (! sq_is8bit($string,'iso-8859-6')) |
d672fcab |
51 | return $string; |
52 | |
53 | $iso8859_6 = array( |
e53c9681 |
54 | "\xA0" => ' ', |
55 | "\xA4" => '¤', |
56 | "\xAC" => '،', |
57 | "\xAD" => '­', |
58 | "\xBB" => '؛', |
59 | "\xBF" => '؟', |
60 | "\xC1" => 'ء', |
61 | "\xC2" => 'آ', |
62 | "\xC3" => 'أ', |
63 | "\xC4" => 'ؤ', |
64 | "\xC5" => 'إ', |
65 | "\xC6" => 'ئ', |
66 | "\xC7" => 'ا', |
67 | "\xC8" => 'ب', |
68 | "\xC9" => 'ة', |
69 | "\xCA" => 'ت', |
70 | "\xCB" => 'ث', |
71 | "\xCC" => 'ج', |
72 | "\xCD" => 'ح', |
73 | "\xCE" => 'خ', |
74 | "\xCF" => 'د', |
75 | "\xD0" => 'ذ', |
76 | "\xD1" => 'ر', |
77 | "\xD2" => 'ز', |
78 | "\xD3" => 'س', |
79 | "\xD4" => 'ش', |
80 | "\xD5" => 'ص', |
81 | "\xD6" => 'ض', |
82 | "\xD7" => 'ط', |
83 | "\xD8" => 'ظ', |
84 | "\xD9" => 'ع', |
85 | "\xDA" => 'غ', |
86 | "\xE0" => 'ـ', |
87 | "\xE1" => 'ف', |
88 | "\xE2" => 'ق', |
89 | "\xE3" => 'ك', |
90 | "\xE4" => 'ل', |
91 | "\xE5" => 'م', |
92 | "\xE6" => 'ن', |
93 | "\xE7" => 'ه', |
94 | "\xE8" => 'و', |
95 | "\xE9" => 'ى', |
96 | "\xEA" => 'ي', |
97 | "\xEB" => 'ً', |
98 | "\xEC" => 'ٌ', |
99 | "\xED" => 'ٍ', |
100 | "\xEE" => 'َ', |
101 | "\xEF" => 'ُ', |
102 | "\xF0" => 'ِ', |
103 | "\xF1" => 'ّ', |
104 | "\xF2" => 'ْ' |
d672fcab |
105 | ); |
106 | |
cb104e1d |
107 | $string = str_replace(array_keys($iso8859_6), array_values($iso8859_6), $string); |
d672fcab |
108 | |
109 | return $string; |
110 | } |
e53c9681 |
111 | ?> |