123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <?php
- /*
- * decode/cp10006.php
- * $Id$
- *
- * Copyright (c) 2003 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
- * This file contains cp10006 (MacGreek) decoding function that
- * is needed to read cp10006 encoded mails in non-cp10006 locale.
- *
- * Original data taken from:
- * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/GREEK.TXT
- *
- * Name: cp10006_MacGreek to Unicode table
- * Unicode version: 2.0
- * Table version: 2.00
- * Table format: Format A
- * Date: 04/24/96
- * Authors: Lori Brownell <loribr@microsoft.com>
- * K.D. Chang <a-kchang@microsoft.com>
- */
- function charset_decode_cp10006 ($string) {
- global $default_charset;
- if (strtolower($default_charset) == 'x-mac-greek')
- return $string;
- /* Only do the slow convert if there are 8-bit characters */
- /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
- if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) )
- return $string;
- $cp10006 = array(
- "\0x80" => 'Ä',
- "\0x81" => '¹',
- "\0x82" => '²',
- "\0x83" => 'É',
- "\0x84" => '³',
- "\0x85" => 'Ö',
- "\0x86" => 'Ü',
- "\0x87" => '΅',
- "\0x88" => 'à',
- "\0x89" => 'â',
- "\0x8A" => 'ä',
- "\0x8B" => '΄',
- "\0x8C" => '¨',
- "\0x8D" => 'ç',
- "\0x8E" => 'é',
- "\0x8F" => 'è',
- "\0x90" => 'ê',
- "\0x91" => 'ë',
- "\0x92" => '£',
- "\0x93" => '™',
- "\0x94" => 'î',
- "\0x95" => 'ï',
- "\0x96" => '•',
- "\0x97" => '½',
- "\0x98" => '‰',
- "\0x99" => 'ô',
- "\0x9A" => 'ö',
- "\0x9B" => '¦',
- "\0x9C" => '­',
- "\0x9D" => 'ù',
- "\0x9E" => 'û',
- "\0x9F" => 'ü',
- "\0xA0" => '†',
- "\0xA1" => 'Γ',
- "\0xA2" => 'Δ',
- "\0xA3" => 'Θ',
- "\0xA4" => 'Λ',
- "\0xA5" => 'Ξ',
- "\0xA6" => 'Π',
- "\0xA7" => 'ß',
- "\0xA8" => '®',
- "\0xA9" => '©',
- "\0xAA" => 'Σ',
- "\0xAB" => 'Ϊ',
- "\0xAC" => '§',
- "\0xAD" => '≠',
- "\0xAE" => '°',
- "\0xAF" => '·',
- "\0xB0" => 'Α',
- "\0xB1" => '±',
- "\0xB2" => '≤',
- "\0xB3" => '≥',
- "\0xB4" => '¥',
- "\0xB5" => 'Β',
- "\0xB6" => 'Ε',
- "\0xB7" => 'Ζ',
- "\0xB8" => 'Η',
- "\0xB9" => 'Ι',
- "\0xBA" => 'Κ',
- "\0xBB" => 'Μ',
- "\0xBC" => 'Φ',
- "\0xBD" => 'Ϋ',
- "\0xBE" => 'Ψ',
- "\0xBF" => 'Ω',
- "\0xC0" => 'ά',
- "\0xC1" => 'Ν',
- "\0xC2" => '¬',
- "\0xC3" => 'Ο',
- "\0xC4" => 'Ρ',
- "\0xC5" => '≈',
- "\0xC6" => 'Τ',
- "\0xC7" => '«',
- "\0xC8" => '»',
- "\0xC9" => '…',
- "\0xCA" => ' ',
- "\0xCB" => 'Υ',
- "\0xCC" => 'Χ',
- "\0xCD" => 'Ά',
- "\0xCE" => 'Έ',
- "\0xCF" => 'œ',
- "\0xD0" => '–',
- "\0xD1" => '―',
- "\0xD2" => '“',
- "\0xD3" => '”',
- "\0xD4" => '‘',
- "\0xD5" => '’',
- "\0xD6" => '÷',
- "\0xD7" => 'Ή',
- "\0xD8" => 'Ί',
- "\0xD9" => 'Ό',
- "\0xDA" => 'Ύ',
- "\0xDB" => 'έ',
- "\0xDC" => 'ή',
- "\0xDD" => 'ί',
- "\0xDE" => 'ό',
- "\0xDF" => 'Ώ',
- "\0xE0" => 'ύ',
- "\0xE1" => 'α',
- "\0xE2" => 'β',
- "\0xE3" => 'ψ',
- "\0xE4" => 'δ',
- "\0xE5" => 'ε',
- "\0xE6" => 'φ',
- "\0xE7" => 'γ',
- "\0xE8" => 'η',
- "\0xE9" => 'ι',
- "\0xEA" => 'ξ',
- "\0xEB" => 'κ',
- "\0xEC" => 'λ',
- "\0xED" => 'μ',
- "\0xEE" => 'ν',
- "\0xEF" => 'ο',
- "\0xF0" => 'π',
- "\0xF1" => 'ώ',
- "\0xF2" => 'ρ',
- "\0xF3" => 'σ',
- "\0xF4" => 'τ',
- "\0xF5" => 'θ',
- "\0xF6" => 'ω',
- "\0xF7" => 'ς',
- "\0xF8" => 'χ',
- "\0xF9" => 'υ',
- "\0xFA" => 'ζ',
- "\0xFB" => 'ϊ',
- "\0xFC" => 'ϋ',
- "\0xFD" => 'ΐ',
- "\0xFE" => 'ΰ',
- "\0xFF" => ''
- );
- $string = str_replace(array_keys($cp10006), array_values($cp10006), $string);
- return $string;
- }
- ?>
|