/usr/share/squirrelmail/functions/decode/cp1251.php is in squirrelmail 2:1.4.23~svn20120406-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <?php
/**
* decode/cp1251.php
*
* This file contains cp1251 decoding function that is needed to read
* cp1251 encoded mails in non-cp1251 locale.
*
* Original data taken from:
* ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT
*
* Name: cp1251 to Unicode table
* Unicode version: 2.0
* Table version: 2.01
* Table format: Format A
* Date: 04/15/98
* Contact: cpxlate@microsoft.com
*
* @copyright 2003-2012 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: cp1251.php 14248 2012-01-02 00:18:17Z pdontthink $
* @package squirrelmail
* @subpackage decode
*/
/**
* Decode cp1251-encoded string
* @param string $string Encoded string
* @return string $string Decoded string
*/
function charset_decode_cp1251 ($string) {
// don't do decoding when there are no 8bit symbols
if (! sq_is8bit($string,'windows-1251'))
return $string;
$cp1251 = 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($cp1251), array_values($cp1251), $string);
return $string;
}
|