|
@@ -1,176 +0,0 @@
|
|
|
-<?php
|
|
|
-/**
|
|
|
- * decode/cp10017.php
|
|
|
- * $Id$
|
|
|
- *
|
|
|
- * Copyright (c) 2003 The SquirrelMail Project Team
|
|
|
- * Licensed under the GNU GPL. For full terms see the file COPYING.
|
|
|
- *
|
|
|
- * This file contains cp10017 (MacUkrainian) decoding function that
|
|
|
- * is needed to read cp10017 encoded mails in non-cp10017 locale.
|
|
|
- *
|
|
|
- * Apple states [2] that x-mac-ukrainian differs from x-mac-cyrillic [1]
|
|
|
- * only in two places. According to [3] these symbols are:
|
|
|
- * 0x92 - U+1168 - CYRILLIC CAPITAL LETTER GHE WITH UPTURN
|
|
|
- * 0xD6 - U+1169 - CYRILLIC SMALL LETTER GHE WITH UPTURN
|
|
|
- *
|
|
|
- * References:
|
|
|
- * 1. ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/MAC/CYRILLIC.TXT
|
|
|
- * 2. http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html
|
|
|
- * 3. http://shlimazl.nm.ru/rus/cptable.htm (page in Russian)
|
|
|
- * @package squirrelmail
|
|
|
- * @subpackage decode
|
|
|
- */
|
|
|
-
|
|
|
-/**
|
|
|
- * Decode a cp10017 (MacUkrainian) string
|
|
|
- * @param string $string Encoded string
|
|
|
- * @return string $string Decoded string
|
|
|
- */
|
|
|
-function charset_decode_cp10017 ($string) {
|
|
|
- global $default_charset;
|
|
|
-
|
|
|
- if (strtolower($default_charset) == 'x-mac-ukrainian')
|
|
|
- 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;
|
|
|
-
|
|
|
- $cp10017 = array(
|
|
|
- "\x80" => 'А',
|
|
|
- "\x81" => 'Б',
|
|
|
- "\x82" => 'В',
|
|
|
- "\x83" => 'Г',
|
|
|
- "\x84" => 'Д',
|
|
|
- "\x85" => 'Е',
|
|
|
- "\x86" => 'Ж',
|
|
|
- "\x87" => 'З',
|
|
|
- "\x88" => 'И',
|
|
|
- "\x89" => 'Й',
|
|
|
- "\x8A" => 'К',
|
|
|
- "\x8B" => 'Л',
|
|
|
- "\x8C" => 'М',
|
|
|
- "\x8D" => 'Н',
|
|
|
- "\x8E" => 'О',
|
|
|
- "\x8F" => 'П',
|
|
|
- "\x90" => 'Р',
|
|
|
- "\x91" => 'С',
|
|
|
- "\x92" => 'Ґ',
|
|
|
- "\x93" => 'У',
|
|
|
- "\x94" => 'Ф',
|
|
|
- "\x95" => 'Х',
|
|
|
- "\x96" => 'Ц',
|
|
|
- "\x97" => 'Ч',
|
|
|
- "\x98" => 'Ш',
|
|
|
- "\x99" => 'Щ',
|
|
|
- "\x9A" => 'Ъ',
|
|
|
- "\x9B" => 'Ы',
|
|
|
- "\x9C" => 'Ь',
|
|
|
- "\x9D" => 'Э',
|
|
|
- "\x9E" => 'Ю',
|
|
|
- "\x9F" => 'Я',
|
|
|
- "\xA0" => '†',
|
|
|
- "\xA1" => '°',
|
|
|
- "\xA2" => '¢',
|
|
|
- "\xA3" => '£',
|
|
|
- "\xA4" => '§',
|
|
|
- "\xA5" => '•',
|
|
|
- "\xA6" => '¶',
|
|
|
- "\xA7" => 'І',
|
|
|
- "\xA8" => '®',
|
|
|
- "\xA9" => '©',
|
|
|
- "\xAA" => '™',
|
|
|
- "\xAB" => 'Ђ',
|
|
|
- "\xAC" => 'ђ',
|
|
|
- "\xAD" => '≠',
|
|
|
- "\xAE" => 'Ѓ',
|
|
|
- "\xAF" => 'ѓ',
|
|
|
- "\xB0" => '∞',
|
|
|
- "\xB1" => '±',
|
|
|
- "\xB2" => '≤',
|
|
|
- "\xB3" => '≥',
|
|
|
- "\xB4" => 'і',
|
|
|
- "\xB5" => 'µ',
|
|
|
- "\xB6" => '∂',
|
|
|
- "\xB7" => 'Ј',
|
|
|
- "\xB8" => 'Є',
|
|
|
- "\xB9" => 'є',
|
|
|
- "\xBA" => 'Ї',
|
|
|
- "\xBB" => 'ї',
|
|
|
- "\xBC" => 'Љ',
|
|
|
- "\xBD" => 'љ',
|
|
|
- "\xBE" => 'Њ',
|
|
|
- "\xBF" => 'њ',
|
|
|
- "\xC0" => 'ј',
|
|
|
- "\xC1" => 'Ѕ',
|
|
|
- "\xC2" => '¬',
|
|
|
- "\xC3" => '√',
|
|
|
- "\xC4" => 'ƒ',
|
|
|
- "\xC5" => '≈',
|
|
|
- "\xC6" => '∆',
|
|
|
- "\xC7" => '«',
|
|
|
- "\xC8" => '»',
|
|
|
- "\xC9" => '…',
|
|
|
- "\xCA" => ' ',
|
|
|
- "\xCB" => 'Ћ',
|
|
|
- "\xCC" => 'ћ',
|
|
|
- "\xCD" => 'Ќ',
|
|
|
- "\xCE" => 'ќ',
|
|
|
- "\xCF" => 'ѕ',
|
|
|
- "\xD0" => '–',
|
|
|
- "\xD1" => '—',
|
|
|
- "\xD2" => '“',
|
|
|
- "\xD3" => '”',
|
|
|
- "\xD4" => '‘',
|
|
|
- "\xD5" => '’',
|
|
|
- "\xD6" => 'ґ',
|
|
|
- "\xD7" => '„',
|
|
|
- "\xD8" => 'Ў',
|
|
|
- "\xD9" => 'ў',
|
|
|
- "\xDA" => 'Џ',
|
|
|
- "\xDB" => 'џ',
|
|
|
- "\xDC" => '№',
|
|
|
- "\xDD" => 'Ё',
|
|
|
- "\xDE" => 'ё',
|
|
|
- "\xDF" => 'я',
|
|
|
- "\xE0" => 'а',
|
|
|
- "\xE1" => 'б',
|
|
|
- "\xE2" => 'в',
|
|
|
- "\xE3" => 'г',
|
|
|
- "\xE4" => 'д',
|
|
|
- "\xE5" => 'е',
|
|
|
- "\xE6" => 'ж',
|
|
|
- "\xE7" => 'з',
|
|
|
- "\xE8" => 'и',
|
|
|
- "\xE9" => 'й',
|
|
|
- "\xEA" => 'к',
|
|
|
- "\xEB" => 'л',
|
|
|
- "\xEC" => 'м',
|
|
|
- "\xED" => 'н',
|
|
|
- "\xEE" => 'о',
|
|
|
- "\xEF" => 'п',
|
|
|
- "\xF0" => 'р',
|
|
|
- "\xF1" => 'с',
|
|
|
- "\xF2" => 'т',
|
|
|
- "\xF3" => 'у',
|
|
|
- "\xF4" => 'ф',
|
|
|
- "\xF5" => 'х',
|
|
|
- "\xF6" => 'ц',
|
|
|
- "\xF7" => 'ч',
|
|
|
- "\xF8" => 'ш',
|
|
|
- "\xF9" => 'щ',
|
|
|
- "\xFA" => 'ъ',
|
|
|
- "\xFB" => 'ы',
|
|
|
- "\xFC" => 'ь',
|
|
|
- "\xFD" => 'э',
|
|
|
- "\xFE" => 'ю',
|
|
|
- "\xFF" => '¤'
|
|
|
- );
|
|
|
-
|
|
|
- $string = str_replace(array_keys($cp10017), array_values($cp10017), $string);
|
|
|
-
|
|
|
- return $string;
|
|
|
-}
|
|
|
-?>
|