| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * decode/iso8859-5.php |
| 5 | * |
| 6 | * This file contains iso-8859-5 decoding function that is needed to read |
| 7 | * iso-8859-5 encoded mails in non-iso-8859-5 locale. |
| 8 | * |
| 9 | * Original data taken from: |
| 10 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-5.TXT |
| 11 | * |
| 12 | * Name: ISO 8859-5: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: |
| 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-5 encoded string |
| 45 | * @param string $string Encoded string |
| 46 | * @return string $string Decoded string |
| 47 | */ |
| 48 | function charset_decode_iso_8859_5 ($string) { |
| 49 | // don't do decoding when there are no 8bit symbols |
| 50 | if (! sq_is8bit($string,'iso-8859-5')) |
| 51 | return $string; |
| 52 | |
| 53 | $iso8859_5 = array( |
| 54 | "\xA0" => ' ', |
| 55 | "\xA1" => 'Ё', |
| 56 | "\xA2" => 'Ђ', |
| 57 | "\xA3" => 'Ѓ', |
| 58 | "\xA4" => 'Є', |
| 59 | "\xA5" => 'Ѕ', |
| 60 | "\xA6" => 'І', |
| 61 | "\xA7" => 'Ї', |
| 62 | "\xA8" => 'Ј', |
| 63 | "\xA9" => 'Љ', |
| 64 | "\xAA" => 'Њ', |
| 65 | "\xAB" => 'Ћ', |
| 66 | "\xAC" => 'Ќ', |
| 67 | "\xAD" => '­', |
| 68 | "\xAE" => 'Ў', |
| 69 | "\xAF" => 'Џ', |
| 70 | "\xB0" => 'А', |
| 71 | "\xB1" => 'Б', |
| 72 | "\xB2" => 'В', |
| 73 | "\xB3" => 'Г', |
| 74 | "\xB4" => 'Д', |
| 75 | "\xB5" => 'Е', |
| 76 | "\xB6" => 'Ж', |
| 77 | "\xB7" => 'З', |
| 78 | "\xB8" => 'И', |
| 79 | "\xB9" => 'Й', |
| 80 | "\xBA" => 'К', |
| 81 | "\xBB" => 'Л', |
| 82 | "\xBC" => 'М', |
| 83 | "\xBD" => 'Н', |
| 84 | "\xBE" => 'О', |
| 85 | "\xBF" => 'П', |
| 86 | "\xC0" => 'Р', |
| 87 | "\xC1" => 'С', |
| 88 | "\xC2" => 'Т', |
| 89 | "\xC3" => 'У', |
| 90 | "\xC4" => 'Ф', |
| 91 | "\xC5" => 'Х', |
| 92 | "\xC6" => 'Ц', |
| 93 | "\xC7" => 'Ч', |
| 94 | "\xC8" => 'Ш', |
| 95 | "\xC9" => 'Щ', |
| 96 | "\xCA" => 'Ъ', |
| 97 | "\xCB" => 'Ы', |
| 98 | "\xCC" => 'Ь', |
| 99 | "\xCD" => 'Э', |
| 100 | "\xCE" => 'Ю', |
| 101 | "\xCF" => 'Я', |
| 102 | "\xD0" => 'а', |
| 103 | "\xD1" => 'б', |
| 104 | "\xD2" => 'в', |
| 105 | "\xD3" => 'г', |
| 106 | "\xD4" => 'д', |
| 107 | "\xD5" => 'е', |
| 108 | "\xD6" => 'ж', |
| 109 | "\xD7" => 'з', |
| 110 | "\xD8" => 'и', |
| 111 | "\xD9" => 'й', |
| 112 | "\xDA" => 'к', |
| 113 | "\xDB" => 'л', |
| 114 | "\xDC" => 'м', |
| 115 | "\xDD" => 'н', |
| 116 | "\xDE" => 'о', |
| 117 | "\xDF" => 'п', |
| 118 | "\xE0" => 'р', |
| 119 | "\xE1" => 'с', |
| 120 | "\xE2" => 'т', |
| 121 | "\xE3" => 'у', |
| 122 | "\xE4" => 'ф', |
| 123 | "\xE5" => 'х', |
| 124 | "\xE6" => 'ц', |
| 125 | "\xE7" => 'ч', |
| 126 | "\xE8" => 'ш', |
| 127 | "\xE9" => 'щ', |
| 128 | "\xEA" => 'ъ', |
| 129 | "\xEB" => 'ы', |
| 130 | "\xEC" => 'ь', |
| 131 | "\xED" => 'э', |
| 132 | "\xEE" => 'ю', |
| 133 | "\xEF" => 'я', |
| 134 | "\xF0" => '№', |
| 135 | "\xF1" => 'ё', |
| 136 | "\xF2" => 'ђ', |
| 137 | "\xF3" => 'ѓ', |
| 138 | "\xF4" => 'є', |
| 139 | "\xF5" => 'ѕ', |
| 140 | "\xF6" => 'і', |
| 141 | "\xF7" => 'ї', |
| 142 | "\xF8" => 'ј', |
| 143 | "\xF9" => 'љ', |
| 144 | "\xFA" => 'њ', |
| 145 | "\xFB" => 'ћ', |
| 146 | "\xFC" => 'ќ', |
| 147 | "\xFD" => '§', |
| 148 | "\xFE" => 'ў', |
| 149 | "\xFF" => 'џ' |
| 150 | ); |
| 151 | |
| 152 | $string = str_replace(array_keys($iso8859_5), array_values($iso8859_5), $string); |
| 153 | |
| 154 | return $string; |
| 155 | } |
| 156 | ?> |