1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
<?php
/**
* functions/decode/x-mac-cyrillic.php
* $Id: x_mac_cyrillic.php 12467 2007-06-25 15:52:44Z kink $
*
* Copyright (c) 2003-2005 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Original data taken from:
* ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/APPLE/CYRILLIC.TXT
*
* Contents: Map (external version) from Mac OS Cyrillic
* character set to Unicode 2.1 through Unicode 3.2
*
* Copyright: (c) 1995-2002 by Apple Computer, Inc., all rights reserved.
*
* Contact: charsets@apple.com
*
* Standard header:
* Apple, the Apple logo, and Macintosh are trademarks of Apple
* Computer, Inc., registered in the United States and other countries.
* Unicode is a trademark of Unicode Inc. For the sake of brevity,
* throughout this document, ""Macintosh"" can be used to refer to
* Macintosh computers and ""Unicode"" can be used to refer to the
* Unicode standard.
*
* Apple makes no warranty or representation, either express or
* implied, with respect to these tables, their quality, accuracy, or
* fitness for a particular purpose. In no event will Apple be liable
* for direct, indirect, special, incidental, or consequential damages
* resulting from any defect or inaccuracy in this document or the
* accompanying tables.
*
* These mapping tables and character lists are subject to change.
* The latest tables should be available from the following:
*
* <http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/>
*
* @package decode
* @subpackage x-mac
*/
/**
* Decode x-mac-cyrillic string
* @param string $string String to decode
* @return string $string Html formated string
*/
function charset_decode_x_mac_cyrillic ($string) {
// don't do decoding when there are no 8bit symbols
if (! sq_is8bit($string,'x-mac-cyrillic'))
return $string;
$mac_cyrillic = 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($mac_cyrillic), array_values($mac_cyrillic), $string);
return $string;
}
|