| 1 | <?php |
| 2 | /** |
| 3 | * decode/iso8859-14.php |
| 4 | * |
| 5 | * Copyright (c) 2003-2005 The SquirrelMail Project Team |
| 6 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 7 | * |
| 8 | * This file contains iso-8859-14 decoding function that is needed to read |
| 9 | * iso-8859-14 encoded mails in non-iso-8859-14 locale. |
| 10 | * |
| 11 | * Original data taken from: |
| 12 | * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-14.TXT |
| 13 | * |
| 14 | * Name: ISO/IEC 8859-14:1998 to Unicode |
| 15 | * Unicode version: 3.0 |
| 16 | * Table version: 1.0 |
| 17 | * Table format: Format A |
| 18 | * Date: 1999 July 27 |
| 19 | * Authors: Markus Kuhn <mkuhn@acm.org> |
| 20 | * 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 | * @version $Id$ |
| 40 | * @package squirrelmail |
| 41 | * @subpackage decode |
| 42 | */ |
| 43 | |
| 44 | /** |
| 45 | * Decode iso8859-14 encoded string |
| 46 | * @param string $string Encoded string |
| 47 | * @return string $string Decoded string |
| 48 | */ |
| 49 | function charset_decode_iso_8859_14 ($string) { |
| 50 | // don't do decoding when there are no 8bit symbols |
| 51 | if (! sq_is8bit($string,'iso-8859-14')) |
| 52 | return $string; |
| 53 | |
| 54 | $iso8859_14 = array( |
| 55 | "\xA0" => ' ', |
| 56 | "\xA1" => 'Ḃ', |
| 57 | "\xA2" => 'ḃ', |
| 58 | "\xA3" => '£', |
| 59 | "\xA4" => 'Ċ', |
| 60 | "\xA5" => 'ċ', |
| 61 | "\xA6" => 'Ḋ', |
| 62 | "\xA7" => '§', |
| 63 | "\xA8" => 'Ẁ', |
| 64 | "\xA9" => '©', |
| 65 | "\xAA" => 'Ẃ', |
| 66 | "\xAB" => 'ḋ', |
| 67 | "\xAC" => 'Ỳ', |
| 68 | "\xAD" => '­', |
| 69 | "\xAE" => '®', |
| 70 | "\xAF" => 'Ÿ', |
| 71 | "\xB0" => 'Ḟ', |
| 72 | "\xB1" => 'ḟ', |
| 73 | "\xB2" => 'Ġ', |
| 74 | "\xB3" => 'ġ', |
| 75 | "\xB4" => 'Ṁ', |
| 76 | "\xB5" => 'ṁ', |
| 77 | "\xB6" => '¶', |
| 78 | "\xB7" => 'Ṗ', |
| 79 | "\xB8" => 'ẁ', |
| 80 | "\xB9" => 'ṗ', |
| 81 | "\xBA" => 'ẃ', |
| 82 | "\xBB" => 'Ṡ', |
| 83 | "\xBC" => 'ỳ', |
| 84 | "\xBD" => 'Ẅ', |
| 85 | "\xBE" => 'ẅ', |
| 86 | "\xBF" => 'ṡ', |
| 87 | "\xC0" => 'À', |
| 88 | "\xC1" => 'Á', |
| 89 | "\xC2" => 'Â', |
| 90 | "\xC3" => 'Ã', |
| 91 | "\xC4" => 'Ä', |
| 92 | "\xC5" => 'Å', |
| 93 | "\xC6" => 'Æ', |
| 94 | "\xC7" => 'Ç', |
| 95 | "\xC8" => 'È', |
| 96 | "\xC9" => 'É', |
| 97 | "\xCA" => 'Ê', |
| 98 | "\xCB" => 'Ë', |
| 99 | "\xCC" => 'Ì', |
| 100 | "\xCD" => 'Í', |
| 101 | "\xCE" => 'Î', |
| 102 | "\xCF" => 'Ï', |
| 103 | "\xD0" => 'Ŵ', |
| 104 | "\xD1" => 'Ñ', |
| 105 | "\xD2" => 'Ò', |
| 106 | "\xD3" => 'Ó', |
| 107 | "\xD4" => 'Ô', |
| 108 | "\xD5" => 'Õ', |
| 109 | "\xD6" => 'Ö', |
| 110 | "\xD7" => 'Ṫ', |
| 111 | "\xD8" => 'Ø', |
| 112 | "\xD9" => 'Ù', |
| 113 | "\xDA" => 'Ú', |
| 114 | "\xDB" => 'Û', |
| 115 | "\xDC" => 'Ü', |
| 116 | "\xDD" => 'Ý', |
| 117 | "\xDE" => 'Ŷ', |
| 118 | "\xDF" => 'ß', |
| 119 | "\xE0" => 'à', |
| 120 | "\xE1" => 'á', |
| 121 | "\xE2" => 'â', |
| 122 | "\xE3" => 'ã', |
| 123 | "\xE4" => 'ä', |
| 124 | "\xE5" => 'å', |
| 125 | "\xE6" => 'æ', |
| 126 | "\xE7" => 'ç', |
| 127 | "\xE8" => 'è', |
| 128 | "\xE9" => 'é', |
| 129 | "\xEA" => 'ê', |
| 130 | "\xEB" => 'ë', |
| 131 | "\xEC" => 'ì', |
| 132 | "\xED" => 'í', |
| 133 | "\xEE" => 'î', |
| 134 | "\xEF" => 'ï', |
| 135 | "\xF0" => 'ŵ', |
| 136 | "\xF1" => 'ñ', |
| 137 | "\xF2" => 'ò', |
| 138 | "\xF3" => 'ó', |
| 139 | "\xF4" => 'ô', |
| 140 | "\xF5" => 'õ', |
| 141 | "\xF6" => 'ö', |
| 142 | "\xF7" => 'ṫ', |
| 143 | "\xF8" => 'ø', |
| 144 | "\xF9" => 'ù', |
| 145 | "\xFA" => 'ú', |
| 146 | "\xFB" => 'û', |
| 147 | "\xFC" => 'ü', |
| 148 | "\xFD" => 'ý', |
| 149 | "\xFE" => 'ŷ', |
| 150 | "\xFF" => 'ÿ' |
| 151 | ); |
| 152 | |
| 153 | $string = str_replace(array_keys($iso8859_14), array_values($iso8859_14), $string); |
| 154 | |
| 155 | return $string; |
| 156 | } |
| 157 | ?> |