Phpdocumentor update - sed is your friend for these kinds of things ;)
[squirrelmail.git] / functions / decode / iso_8859_6.php
CommitLineData
d672fcab 1<?php
d6c32258 2/**
d672fcab 3 * decode/iso8859-6.php
d672fcab 4 *
82d304a0 5 * Copyright (c) 2003-2004 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.
10 *
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:
22 * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
23 *
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.
31 *
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 48function charset_decode_iso_8859_6 ($string) {
d672fcab 49 global $default_charset;
50
51 if (strtolower($default_charset) == 'iso-8859-6')
52 return $string;
53
54 /* Only do the slow convert if there are 8-bit characters */
55 /* there is no 0x80-0x9F letters in ISO8859-* */
56 if ( ! ereg("[\241-\377]", $string) )
57 return $string;
58
59 $iso8859_6 = array(
60 "\xA0" => '&#160;',
61 "\xA4" => '&#164;',
62 "\xAC" => '&#1548;',
63 "\xAD" => '&#173;',
64 "\xBB" => '&#1563;',
65 "\xBF" => '&#1567;',
66 "\xC1" => '&#1569;',
67 "\xC2" => '&#1570;',
68 "\xC3" => '&#1571;',
69 "\xC4" => '&#1572;',
70 "\xC5" => '&#1573;',
71 "\xC6" => '&#1574;',
72 "\xC7" => '&#1575;',
73 "\xC8" => '&#1576;',
74 "\xC9" => '&#1577;',
75 "\xCA" => '&#1578;',
76 "\xCB" => '&#1579;',
77 "\xCC" => '&#1580;',
78 "\xCD" => '&#1581;',
79 "\xCE" => '&#1582;',
80 "\xCF" => '&#1583;',
81 "\xD0" => '&#1584;',
82 "\xD1" => '&#1585;',
83 "\xD2" => '&#1586;',
84 "\xD3" => '&#1587;',
85 "\xD4" => '&#1588;',
86 "\xD5" => '&#1589;',
87 "\xD6" => '&#1590;',
88 "\xD7" => '&#1591;',
89 "\xD8" => '&#1592;',
90 "\xD9" => '&#1593;',
91 "\xDA" => '&#1594;',
92 "\xE0" => '&#1600;',
93 "\xE1" => '&#1601;',
94 "\xE2" => '&#1602;',
95 "\xE3" => '&#1603;',
96 "\xE4" => '&#1604;',
97 "\xE5" => '&#1605;',
98 "\xE6" => '&#1606;',
99 "\xE7" => '&#1607;',
100 "\xE8" => '&#1608;',
101 "\xE9" => '&#1609;',
102 "\xEA" => '&#1610;',
103 "\xEB" => '&#1611;',
104 "\xEC" => '&#1612;',
105 "\xED" => '&#1613;',
106 "\xEE" => '&#1614;',
107 "\xEF" => '&#1615;',
108 "\xF0" => '&#1616;',
109 "\xF1" => '&#1617;',
110 "\xF2" => '&#1618;'
111 );
112
cb104e1d 113 $string = str_replace(array_keys($iso8859_6), array_values($iso8859_6), $string);
d672fcab 114
115 return $string;
116}
117
d6c32258 118?>