| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * decode/iso8859-8.php |
| 5 | * |
| 6 | * This file contains iso-8859-8 decoding function that is needed to read |
| 7 | * iso-8859-8 encoded mails in non-iso-8859-8 locale. |
| 8 | * |
| 9 | * Original data taken from: |
| 10 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-8.TXT |
| 11 | * |
| 12 | * Name: ISO/IEC 8859-8:1999 to Unicode |
| 13 | * Unicode version: 3.0 |
| 14 | * Table version: 1.1 |
| 15 | * Table format: Format A |
| 16 | * Date: 2000-Jan-03 |
| 17 | * Authors: Ken Whistler <kenw@sybase.com> |
| 18 | * |
| 19 | * Original copyright: |
| 20 | * Copyright (c) 1999 Unicode, Inc. All Rights reserved. |
| 21 | * |
| 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. |
| 29 | * |
| 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. |
| 35 | * |
| 36 | * @copyright © 2003-2006 The SquirrelMail Project Team |
| 37 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 38 | * @version $Id$ |
| 39 | * @package squirrelmail |
| 40 | * @subpackage decode |
| 41 | */ |
| 42 | |
| 43 | /** |
| 44 | * Decode iso8859-8 encoded strings |
| 45 | * @param string $string Encoded string |
| 46 | * @return string $string Decoded string |
| 47 | */ |
| 48 | function charset_decode_iso_8859_8 ($string) { |
| 49 | // don't do decoding when there are no 8bit symbols |
| 50 | if (! sq_is8bit($string,'iso-8859-8')) |
| 51 | return $string; |
| 52 | |
| 53 | $iso8859_8 = array( |
| 54 | "\xA0" => ' ', |
| 55 | "\xA2" => '¢', |
| 56 | "\xA3" => '£', |
| 57 | "\xA4" => '¤', |
| 58 | "\xA5" => '¥', |
| 59 | "\xA6" => '¦', |
| 60 | "\xA7" => '§', |
| 61 | "\xA8" => '¨', |
| 62 | "\xA9" => '©', |
| 63 | "\xAA" => '×', |
| 64 | "\xAB" => '«', |
| 65 | "\xAC" => '¬', |
| 66 | "\xAD" => '­', |
| 67 | "\xAE" => '®', |
| 68 | "\xAF" => '¯', |
| 69 | "\xB0" => '°', |
| 70 | "\xB1" => '±', |
| 71 | "\xB2" => '²', |
| 72 | "\xB3" => '³', |
| 73 | "\xB4" => '´', |
| 74 | "\xB5" => 'µ', |
| 75 | "\xB6" => '¶', |
| 76 | "\xB7" => '·', |
| 77 | "\xB8" => '¸', |
| 78 | "\xB9" => '¹', |
| 79 | "\xBA" => '÷', |
| 80 | "\xBB" => '»', |
| 81 | "\xBC" => '¼', |
| 82 | "\xBD" => '½', |
| 83 | "\xBE" => '¾', |
| 84 | "\xDF" => '‗', |
| 85 | "\xE0" => 'א', |
| 86 | "\xE1" => 'ב', |
| 87 | "\xE2" => 'ג', |
| 88 | "\xE3" => 'ד', |
| 89 | "\xE4" => 'ה', |
| 90 | "\xE5" => 'ו', |
| 91 | "\xE6" => 'ז', |
| 92 | "\xE7" => 'ח', |
| 93 | "\xE8" => 'ט', |
| 94 | "\xE9" => 'י', |
| 95 | "\xEA" => 'ך', |
| 96 | "\xEB" => 'כ', |
| 97 | "\xEC" => 'ל', |
| 98 | "\xED" => 'ם', |
| 99 | "\xEE" => 'מ', |
| 100 | "\xEF" => 'ן', |
| 101 | "\xF0" => 'נ', |
| 102 | "\xF1" => 'ס', |
| 103 | "\xF2" => 'ע', |
| 104 | "\xF3" => 'ף', |
| 105 | "\xF4" => 'פ', |
| 106 | "\xF5" => 'ץ', |
| 107 | "\xF6" => 'צ', |
| 108 | "\xF7" => 'ק', |
| 109 | "\xF8" => 'ר', |
| 110 | "\xF9" => 'ש', |
| 111 | "\xFA" => 'ת', |
| 112 | "\xFD" => '‎', |
| 113 | "\xFE" => '‏' |
| 114 | ); |
| 115 | |
| 116 | $string = str_replace(array_keys($iso8859_8), array_values($iso8859_8), $string); |
| 117 | |
| 118 | return $string; |
| 119 | } |