Seriously? The variable is named as an array and initialized as a string? Well, I...
[squirrelmail.git] / functions / decode / iso_8859_6.php
CommitLineData
d672fcab 1<?php
4b4abf93 2
d6c32258 3/**
d672fcab 4 * decode/iso8859-6.php
d672fcab 5 *
d672fcab 6 * This file contains iso-8859-6 decoding function that is needed to read
7 * iso-8859-6 encoded mails in non-iso-8859-6 locale.
91e0dccc 8 *
d672fcab 9 * Original data taken from:
10 * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-6.TXT
11 *
12 * Name: ISO 8859-6:1999 to Unicode
13 * Unicode version: 3.0
14 * Table version: 1.0
15 * Table format: Format A
16 * Date: 1999 July 27
17 * Authors: Ken Whistler <kenw@sybase.com>
18 *
19 * Original copyright:
e53c9681 20 * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
d672fcab 21 *
e53c9681 22 * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
23 * No claims are made as to fitness for any particular purpose. No
24 * warranties of any kind are expressed or implied. The recipient
25 * agrees to determine applicability of information provided. If this
26 * file has been provided on optical media by Unicode, Inc., the sole
27 * remedy for any claim will be exchange of defective media within 90
28 * days of receipt.
d672fcab 29 *
e53c9681 30 * Unicode, Inc. hereby grants the right to freely use the information
31 * supplied in this file in the creation of products supporting the
32 * Unicode Standard, and to make copies of this file in any form for
33 * internal or external distribution as long as this notice remains
34 * attached.
31841a9e 35 *
22387c8d 36 * @copyright 2003-2017 The SquirrelMail Project Team
4b4abf93 37 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
31841a9e 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) {
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" => '&#160;',
55 "\xA4" => '&#164;',
56 "\xAC" => '&#1548;',
57 "\xAD" => '&#173;',
58 "\xBB" => '&#1563;',
59 "\xBF" => '&#1567;',
60 "\xC1" => '&#1569;',
61 "\xC2" => '&#1570;',
62 "\xC3" => '&#1571;',
63 "\xC4" => '&#1572;',
64 "\xC5" => '&#1573;',
65 "\xC6" => '&#1574;',
66 "\xC7" => '&#1575;',
67 "\xC8" => '&#1576;',
68 "\xC9" => '&#1577;',
69 "\xCA" => '&#1578;',
70 "\xCB" => '&#1579;',
71 "\xCC" => '&#1580;',
72 "\xCD" => '&#1581;',
73 "\xCE" => '&#1582;',
74 "\xCF" => '&#1583;',
75 "\xD0" => '&#1584;',
76 "\xD1" => '&#1585;',
77 "\xD2" => '&#1586;',
78 "\xD3" => '&#1587;',
79 "\xD4" => '&#1588;',
80 "\xD5" => '&#1589;',
81 "\xD6" => '&#1590;',
82 "\xD7" => '&#1591;',
83 "\xD8" => '&#1592;',
84 "\xD9" => '&#1593;',
85 "\xDA" => '&#1594;',
86 "\xE0" => '&#1600;',
87 "\xE1" => '&#1601;',
88 "\xE2" => '&#1602;',
89 "\xE3" => '&#1603;',
90 "\xE4" => '&#1604;',
91 "\xE5" => '&#1605;',
92 "\xE6" => '&#1606;',
93 "\xE7" => '&#1607;',
94 "\xE8" => '&#1608;',
95 "\xE9" => '&#1609;',
96 "\xEA" => '&#1610;',
97 "\xEB" => '&#1611;',
98 "\xEC" => '&#1612;',
99 "\xED" => '&#1613;',
100 "\xEE" => '&#1614;',
101 "\xEF" => '&#1615;',
102 "\xF0" => '&#1616;',
103 "\xF1" => '&#1617;',
104 "\xF2" => '&#1618;'
d672fcab 105 );
106
cb104e1d 107 $string = str_replace(array_keys($iso8859_6), array_values($iso8859_6), $string);
d672fcab 108
109 return $string;
110}