| 1 | <?php |
| 2 | /* |
| 3 | * decode/cp10079.php |
| 4 | * $Id$ |
| 5 | * |
| 6 | * Copyright (c) 2003 The SquirrelMail Project Team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * This file contains cp10079 (MacIcelandic) decoding function that |
| 10 | * is needed to read cp10079 encoded mails in non-cp10079 locale. |
| 11 | * |
| 12 | * Original data taken from: |
| 13 | * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/ICELAND.TXT |
| 14 | * |
| 15 | * Name: cp10079_MacIcelandic to Unicode table |
| 16 | * Unicode version: 2.0 |
| 17 | * Table version: 2.00 |
| 18 | * Table format: Format A |
| 19 | * Date: 04/24/96 |
| 20 | * Authors: Lori Brownell <loribr@microsoft.com> |
| 21 | * K.D. Chang <a-kchang@microsoft.com> |
| 22 | */ |
| 23 | |
| 24 | function charset_decode_cp10079 ($string) { |
| 25 | global $default_charset; |
| 26 | |
| 27 | if (strtolower($default_charset) == 'x-mac-icelandic') |
| 28 | return $string; |
| 29 | |
| 30 | /* Only do the slow convert if there are 8-bit characters */ |
| 31 | /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ |
| 32 | if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) |
| 33 | return $string; |
| 34 | |
| 35 | $cp10079 = array( |
| 36 | "\0x80" => 'Ä', |
| 37 | "\0x81" => 'Å', |
| 38 | "\0x82" => 'Ç', |
| 39 | "\0x83" => 'É', |
| 40 | "\0x84" => 'Ñ', |
| 41 | "\0x85" => 'Ö', |
| 42 | "\0x86" => 'Ü', |
| 43 | "\0x87" => 'á', |
| 44 | "\0x88" => 'à', |
| 45 | "\0x89" => 'â', |
| 46 | "\0x8A" => 'ä', |
| 47 | "\0x8B" => 'ã', |
| 48 | "\0x8C" => 'å', |
| 49 | "\0x8D" => 'ç', |
| 50 | "\0x8E" => 'é', |
| 51 | "\0x8F" => 'è', |
| 52 | "\0x90" => 'ê', |
| 53 | "\0x91" => 'ë', |
| 54 | "\0x92" => 'í', |
| 55 | "\0x93" => 'ì', |
| 56 | "\0x94" => 'î', |
| 57 | "\0x95" => 'ï', |
| 58 | "\0x96" => 'ñ', |
| 59 | "\0x97" => 'ó', |
| 60 | "\0x98" => 'ò', |
| 61 | "\0x99" => 'ô', |
| 62 | "\0x9A" => 'ö', |
| 63 | "\0x9B" => 'õ', |
| 64 | "\0x9C" => 'ú', |
| 65 | "\0x9D" => 'ù', |
| 66 | "\0x9E" => 'û', |
| 67 | "\0x9F" => 'ü', |
| 68 | "\0xA0" => 'Ý', |
| 69 | "\0xA1" => '°', |
| 70 | "\0xA2" => '¢', |
| 71 | "\0xA3" => '£', |
| 72 | "\0xA4" => '§', |
| 73 | "\0xA5" => '•', |
| 74 | "\0xA6" => '¶', |
| 75 | "\0xA7" => 'ß', |
| 76 | "\0xA8" => '®', |
| 77 | "\0xA9" => '©', |
| 78 | "\0xAA" => '™', |
| 79 | "\0xAB" => '´', |
| 80 | "\0xAC" => '¨', |
| 81 | "\0xAD" => '≠', |
| 82 | "\0xAE" => 'Æ', |
| 83 | "\0xAF" => 'Ø', |
| 84 | "\0xB0" => '∞', |
| 85 | "\0xB1" => '±', |
| 86 | "\0xB2" => '≤', |
| 87 | "\0xB3" => '≥', |
| 88 | "\0xB4" => '¥', |
| 89 | "\0xB5" => 'µ', |
| 90 | "\0xB6" => '∂', |
| 91 | "\0xB7" => '∑', |
| 92 | "\0xB8" => '∏', |
| 93 | "\0xB9" => 'π', |
| 94 | "\0xBA" => '∫', |
| 95 | "\0xBB" => 'ª', |
| 96 | "\0xBC" => 'º', |
| 97 | "\0xBD" => 'Ω', |
| 98 | "\0xBE" => 'æ', |
| 99 | "\0xBF" => 'ø', |
| 100 | "\0xC0" => '¿', |
| 101 | "\0xC1" => '¡', |
| 102 | "\0xC2" => '¬', |
| 103 | "\0xC3" => '√', |
| 104 | "\0xC4" => 'ƒ', |
| 105 | "\0xC5" => '≈', |
| 106 | "\0xC6" => '∆', |
| 107 | "\0xC7" => '«', |
| 108 | "\0xC8" => '»', |
| 109 | "\0xC9" => '…', |
| 110 | "\0xCA" => ' ', |
| 111 | "\0xCB" => 'À', |
| 112 | "\0xCC" => 'Ã', |
| 113 | "\0xCD" => 'Õ', |
| 114 | "\0xCE" => 'Œ', |
| 115 | "\0xCF" => 'œ', |
| 116 | "\0xD0" => '–', |
| 117 | "\0xD1" => '—', |
| 118 | "\0xD2" => '“', |
| 119 | "\0xD3" => '”', |
| 120 | "\0xD4" => '‘', |
| 121 | "\0xD5" => '’', |
| 122 | "\0xD6" => '÷', |
| 123 | "\0xD7" => '◊', |
| 124 | "\0xD8" => 'ÿ', |
| 125 | "\0xD9" => 'Ÿ', |
| 126 | "\0xDA" => '⁄', |
| 127 | "\0xDB" => '¤', |
| 128 | "\0xDC" => 'Ð', |
| 129 | "\0xDD" => 'ð', |
| 130 | "\0xDE" => 'Þ', |
| 131 | "\0xDF" => 'þ', |
| 132 | "\0xE0" => 'ý', |
| 133 | "\0xE1" => '·', |
| 134 | "\0xE2" => '‚', |
| 135 | "\0xE3" => '„', |
| 136 | "\0xE4" => '‰', |
| 137 | "\0xE5" => 'Â', |
| 138 | "\0xE6" => 'Ê', |
| 139 | "\0xE7" => 'Á', |
| 140 | "\0xE8" => 'Ë', |
| 141 | "\0xE9" => 'È', |
| 142 | "\0xEA" => 'Í', |
| 143 | "\0xEB" => 'Î', |
| 144 | "\0xEC" => 'Ï', |
| 145 | "\0xED" => 'Ì', |
| 146 | "\0xEE" => 'Ó', |
| 147 | "\0xEF" => 'Ô', |
| 148 | "\0xF0" => '', |
| 149 | "\0xF1" => 'Ò', |
| 150 | "\0xF2" => 'Ú', |
| 151 | "\0xF3" => 'Û', |
| 152 | "\0xF4" => 'Ù', |
| 153 | "\0xF5" => 'ı', |
| 154 | "\0xF6" => 'ˆ', |
| 155 | "\0xF7" => '˜', |
| 156 | "\0xF8" => '¯', |
| 157 | "\0xF9" => '˘', |
| 158 | "\0xFA" => '˙', |
| 159 | "\0xFB" => '˚', |
| 160 | "\0xFC" => '¸', |
| 161 | "\0xFD" => '˝', |
| 162 | "\0xFE" => '˛', |
| 163 | "\0xFF" => 'ˇ' |
| 164 | ); |
| 165 | |
| 166 | $string = str_replace(array_keys($cp10079), array_values($cp10079), $string); |
| 167 | |
| 168 | return $string; |
| 169 | } |
| 170 | ?> |