Today Cyrus 2.2.2-BETA with SASL Initial Client response was released so it
[squirrelmail.git] / functions / decode / iso8859-6.php
CommitLineData
d672fcab 1<?php
2/*
3 * decode/iso8859-6.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-6 decoding function that is needed to read
10 * iso-8859-6 encoded mails in non-iso-8859-6 locale.
11 *
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-6.TXT
14 *
15 * Name: ISO 8859-6:1999 to Unicode
16 * Unicode version: 3.0
17 * Table version: 1.0
18 * Table format: Format A
19 * Date: 1999 July 27
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 */
40function charset_decode_iso8859_6 ($string) {
41 global $default_charset;
42
43 if (strtolower($default_charset) == 'iso-8859-6')
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_6 = array(
52 "\xA0" => '&#160;',
53 "\xA4" => '&#164;',
54 "\xAC" => '&#1548;',
55 "\xAD" => '&#173;',
56 "\xBB" => '&#1563;',
57 "\xBF" => '&#1567;',
58 "\xC1" => '&#1569;',
59 "\xC2" => '&#1570;',
60 "\xC3" => '&#1571;',
61 "\xC4" => '&#1572;',
62 "\xC5" => '&#1573;',
63 "\xC6" => '&#1574;',
64 "\xC7" => '&#1575;',
65 "\xC8" => '&#1576;',
66 "\xC9" => '&#1577;',
67 "\xCA" => '&#1578;',
68 "\xCB" => '&#1579;',
69 "\xCC" => '&#1580;',
70 "\xCD" => '&#1581;',
71 "\xCE" => '&#1582;',
72 "\xCF" => '&#1583;',
73 "\xD0" => '&#1584;',
74 "\xD1" => '&#1585;',
75 "\xD2" => '&#1586;',
76 "\xD3" => '&#1587;',
77 "\xD4" => '&#1588;',
78 "\xD5" => '&#1589;',
79 "\xD6" => '&#1590;',
80 "\xD7" => '&#1591;',
81 "\xD8" => '&#1592;',
82 "\xD9" => '&#1593;',
83 "\xDA" => '&#1594;',
84 "\xE0" => '&#1600;',
85 "\xE1" => '&#1601;',
86 "\xE2" => '&#1602;',
87 "\xE3" => '&#1603;',
88 "\xE4" => '&#1604;',
89 "\xE5" => '&#1605;',
90 "\xE6" => '&#1606;',
91 "\xE7" => '&#1607;',
92 "\xE8" => '&#1608;',
93 "\xE9" => '&#1609;',
94 "\xEA" => '&#1610;',
95 "\xEB" => '&#1611;',
96 "\xEC" => '&#1612;',
97 "\xED" => '&#1613;',
98 "\xEE" => '&#1614;',
99 "\xEF" => '&#1615;',
100 "\xF0" => '&#1616;',
101 "\xF1" => '&#1617;',
102 "\xF2" => '&#1618;'
103 );
104
cb104e1d 105 $string = str_replace(array_keys($iso8859_6), array_values($iso8859_6), $string);
d672fcab 106
107 return $string;
108}
109
110?>