ACC SHELL
<?php
/**
* decode/koi8-r.php
*
* This file contains koi8-r decoding function that is needed to read
* koi8-r encoded mails in non-koi8-r locale.
*
* Original data taken from:
* ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
*
* Name: KOI8-R (RFC1489) to Unicode
* Unicode version: 3.0
* Table version: 1.0
* Table format: Format A
* Date: 18 August 1999
* Authors: Helmut Richter <richter@lrz.de>
*
* Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved.
*
* This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
* No claims are made as to fitness for any particular purpose. No
* warranties of any kind are expressed or implied. The recipient
* agrees to determine applicability of information provided. If this
* file has been provided on optical media by Unicode, Inc., the sole
* remedy for any claim will be exchange of defective media within 90
* days of receipt.
*
* Unicode, Inc. hereby grants the right to freely use the information
* supplied in this file in the creation of products supporting the
* Unicode Standard, and to make copies of this file in any form for
* internal or external distribution as long as this notice remains
* attached.
*
* @copyright 2003-2010 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: koi8_r.php 13893 2010-01-25 02:47:41Z pdontthink $
* @package squirrelmail
* @subpackage decode
*/
/**
* Decode koi8r strings
* @param string $string Encoded string
* @return string Decoded string
*/
function charset_decode_koi8_r ($string) {
// don't do decoding when there are no 8bit symbols
if (! sq_is8bit($string,'koi8-r'))
return $string;
$koi8r = 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($koi8r), array_values($koi8r), $string);
return $string;
}
ACC SHELL 2018