159 lines
5.1 KiB
PHP
159 lines
5.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* decode/iso-ir-111.php
|
|
*
|
|
* This file contains iso-ir-111 decoding function that is needed to read
|
|
* iso-ir-111 encoded mails in non-iso-ir-111 locale.
|
|
*
|
|
* Original data taken from:
|
|
* http://crl.nmsu.edu/~mleisher/csets/ISOIR111.TXT
|
|
*
|
|
* Original ID: Id: ISOIR111.TXT,v 1.2 1999/08/23 18:34:15 mleisher Exp
|
|
* Name: ISO IR 111/ECMA Cyrillic to Unicode 2.1 mapping table.
|
|
* Typed in by hand from
|
|
* http://www.fingertipsoft.com/ref/cyrillic/charsets.html
|
|
* Author: Mark Leisher <mleisher@crl.nmsu.edu>
|
|
* Date: 05 March 1998
|
|
*
|
|
* Original copyright:
|
|
* Copyright 1999 Computing Research Labs, New Mexico State University
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the ""Software""),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
|
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
|
|
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
|
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
* @copyright 2003-2025 The SquirrelMail Project Team
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
* @version $Id$
|
|
* @package squirrelmail
|
|
* @subpackage decode
|
|
*/
|
|
|
|
/**
|
|
* Decode iso-ir-111 encoded strings
|
|
* @param string $string Encoded string
|
|
* @return string Decoded string
|
|
*/
|
|
function charset_decode_iso_ir_111 ($string) {
|
|
// don't do decoding when there are no 8bit symbols
|
|
if (! sq_is8bit($string,'iso-ir-111'))
|
|
return $string;
|
|
|
|
$iso_ir_111 = array(
|
|
"\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($iso_ir_111), array_values($iso_ir_111), $string);
|
|
|
|
return $string;
|
|
}
|