X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fdecode%2Fiso_8859_2.php;h=48d196a37a1bbe0510039d0e16342186a526b98c;hp=da68adcce2aee19852311a4e8883779511c3832b;hb=c4faef335b2362c81b8ebf026d4066c12d70536c;hpb=31841a9ece7cc2ae90bf52dd92db68142172a47b;ds=inline diff --git a/functions/decode/iso_8859_2.php b/functions/decode/iso_8859_2.php index da68adcc..48d196a3 100644 --- a/functions/decode/iso_8859_2.php +++ b/functions/decode/iso_8859_2.php @@ -1,13 +1,11 @@ * * Original copyright: - * Copyright (c) 1999 Unicode, Inc. All Rights reserved. + * Copyright (c) 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. + * 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. + * 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-2020 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail * @subpackage decode @@ -46,118 +46,110 @@ * @return string $string Decoded string */ function charset_decode_iso_8859_2 ($string) { - global $default_charset; - - if (strtolower($default_charset) == 'iso-8859-2') - return $string; - - /* Only do the slow convert if there are 8-bit characters */ - /* there is no 0x80-0x9F letters in ISO8859-* */ - if ( ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'iso-8859-2')) return $string; $iso8859_2 = 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" => '˙' + "\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($iso8859_2), array_values($iso8859_2), $string); return $string; } - -?>