From: tokul Date: Fri, 15 Oct 2004 09:15:49 +0000 (+0000) Subject: using sq_is8bit function instead of ereg. Code reuse and fixes some problems X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e53c9681b4646b7ca1b0071434d360be56a80a6e;p=squirrelmail.git using sq_is8bit function instead of ereg. Code reuse and fixes some problems with mbstring overloading. P.S. SquirrelMail login fails with php_value mbstring.func_overload 2 php_value mbstring.internal_encoding utf-8 git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8182 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/decode/cp1250.php b/functions/decode/cp1250.php index bff8fa3b..779e6b68 100644 --- a/functions/decode/cp1250.php +++ b/functions/decode/cp1250.php @@ -34,9 +34,8 @@ function charset_decode_cp1250 ($string) { if (strtolower($default_charset) == 'windows-1250') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'windows-1250')) return $string; $cp1250 = array( diff --git a/functions/decode/cp1251.php b/functions/decode/cp1251.php index c7ddcde3..5ac43697 100644 --- a/functions/decode/cp1251.php +++ b/functions/decode/cp1251.php @@ -34,9 +34,8 @@ function charset_decode_cp1251 ($string) { if (strtolower($default_charset) == 'windows-1251') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'windows-1251')) return $string; $cp1251 = array( diff --git a/functions/decode/cp1252.php b/functions/decode/cp1252.php index 56218332..ed69e3ac 100644 --- a/functions/decode/cp1252.php +++ b/functions/decode/cp1252.php @@ -35,9 +35,8 @@ function charset_decode_cp1252 ($string) { if (strtolower($default_charset) == 'windows-1252') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'windows-1252')) return $string; $cp1252 = array( diff --git a/functions/decode/cp1253.php b/functions/decode/cp1253.php index 445a38c6..ff69088d 100644 --- a/functions/decode/cp1253.php +++ b/functions/decode/cp1253.php @@ -34,9 +34,8 @@ function charset_decode_cp1253 ($string) { if (strtolower($default_charset) == 'windows-1253') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'windows-1253')) return $string; $cp1253 = array( diff --git a/functions/decode/cp1254.php b/functions/decode/cp1254.php index 2a6276fb..10916c0a 100644 --- a/functions/decode/cp1254.php +++ b/functions/decode/cp1254.php @@ -34,9 +34,8 @@ function charset_decode_cp1254 ($string) { if (strtolower($default_charset) == 'windows-1254') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'windows-1254')) return $string; $cp1254 = array( diff --git a/functions/decode/cp1255.php b/functions/decode/cp1255.php index 08c51bec..1d443fe2 100644 --- a/functions/decode/cp1255.php +++ b/functions/decode/cp1255.php @@ -34,9 +34,8 @@ function charset_decode_cp1255 ($string) { if (strtolower($default_charset) == 'windows-1255') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'windows-1255')) return $string; $cp1255 = array( diff --git a/functions/decode/cp1256.php b/functions/decode/cp1256.php index a61a43cc..832a2556 100644 --- a/functions/decode/cp1256.php +++ b/functions/decode/cp1256.php @@ -34,9 +34,8 @@ function charset_decode_cp1256 ($string) { if (strtolower($default_charset) == 'windows-1256') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'windows-1256')) return $string; $cp1256 = array( diff --git a/functions/decode/cp1257.php b/functions/decode/cp1257.php index fce56b20..0b50e4c0 100644 --- a/functions/decode/cp1257.php +++ b/functions/decode/cp1257.php @@ -34,9 +34,8 @@ function charset_decode_cp1257 ($string) { if (strtolower($default_charset) == 'windows-1257') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'windows-1257')) return $string; $cp1257 = array( diff --git a/functions/decode/cp1258.php b/functions/decode/cp1258.php index 79b4a6c9..4f336e95 100644 --- a/functions/decode/cp1258.php +++ b/functions/decode/cp1258.php @@ -34,9 +34,8 @@ function charset_decode_cp1258 ($string) { if (strtolower($default_charset) == 'windows-1258') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'windows-1258')) return $string; $cp1258 = array( diff --git a/functions/decode/cp855.php b/functions/decode/cp855.php index 97dd27f4..160f9471 100644 --- a/functions/decode/cp855.php +++ b/functions/decode/cp855.php @@ -34,9 +34,8 @@ function charset_decode_cp855 ($string) { if (strtolower($default_charset) == 'ibm855') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'ibm855')) return $string; $cp855 = array( diff --git a/functions/decode/cp866.php b/functions/decode/cp866.php index 91cea2b0..20681d9d 100644 --- a/functions/decode/cp866.php +++ b/functions/decode/cp866.php @@ -36,9 +36,8 @@ function charset_decode_cp866 ($string) { if (strtolower($default_charset) == 'ibm866') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'ibm866')) return $string; $cp866 = array( diff --git a/functions/decode/iso_8859_1.php b/functions/decode/iso_8859_1.php index 6efc59c0..676122cc 100644 --- a/functions/decode/iso_8859_1.php +++ b/functions/decode/iso_8859_1.php @@ -24,9 +24,8 @@ function charset_decode_iso_8859_1 ($string) { if (strtolower($default_charset) == 'iso-8859-1') 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-1')) return $string; $string = preg_replace("/([\201-\237])/e","'&#' . ord('\\1') . ';'",$string); @@ -38,4 +37,4 @@ function charset_decode_iso_8859_1 ($string) { return $string; } -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_10.php b/functions/decode/iso_8859_10.php index 1d611a1c..99978302 100644 --- a/functions/decode/iso_8859_10.php +++ b/functions/decode/iso_8859_10.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,108 +51,107 @@ function charset_decode_iso_8859_10 ($string) { if (strtolower($default_charset) == 'iso-8859-10') 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-10')) return $string; $iso8859_10 = 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_10), array_values($iso8859_10), $string); @@ -160,4 +159,4 @@ function charset_decode_iso_8859_10 ($string) { return $string; } -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_11.php b/functions/decode/iso_8859_11.php index d2036ea7..0629e1fe 100644 --- a/functions/decode/iso_8859_11.php +++ b/functions/decode/iso_8859_11.php @@ -51,9 +51,8 @@ function charset_decode_iso_8859_11 ($string) { if (strtolower($default_charset) == 'iso-8859-11') 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-11')) return $string; $iso8859_11 = array( diff --git a/functions/decode/iso_8859_13.php b/functions/decode/iso_8859_13.php index 0fb0acb1..98f1ef08 100644 --- a/functions/decode/iso_8859_13.php +++ b/functions/decode/iso_8859_13.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,108 +51,107 @@ function charset_decode_iso_8859_13 ($string) { if (strtolower($default_charset) == 'iso-8859-13') 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-13')) return $string; $iso8859_13 = 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_13), array_values($iso8859_13), $string); @@ -160,4 +159,4 @@ function charset_decode_iso_8859_13 ($string) { return $string; } -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_14.php b/functions/decode/iso_8859_14.php index 8921bab7..ae421638 100644 --- a/functions/decode/iso_8859_14.php +++ b/functions/decode/iso_8859_14.php @@ -17,24 +17,24 @@ * Table format: Format A * Date: 1999 July 27 * Authors: Markus Kuhn - * Ken Whistler + * Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -52,113 +52,111 @@ function charset_decode_iso_8859_14 ($string) { if (strtolower($default_charset) == 'iso-8859-14') 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-14')) return $string; $iso8859_14 = 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($iso8869_14), array_values($iso8859_14), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_15.php b/functions/decode/iso_8859_15.php index 6f8c9b3a..f6dc426f 100644 --- a/functions/decode/iso_8859_15.php +++ b/functions/decode/iso_8859_15.php @@ -17,24 +17,24 @@ * Table format: Format A * Date: 1999 July 27 * Authors: Markus Kuhn - * Ken Whistler + * Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -52,113 +52,111 @@ function charset_decode_iso_8859_15 ($string) { if (strtolower($default_charset) == 'iso-8859-15') 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-15')) return $string; $iso8859_15 = 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_15), array_values($iso8859_15), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_16.php b/functions/decode/iso_8859_16.php index 6cab03a3..b1bf326f 100644 --- a/functions/decode/iso_8859_16.php +++ b/functions/decode/iso_8859_16.php @@ -19,21 +19,21 @@ * Authors: Markus Kuhn * * 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. * * @version $Id$ * @package squirrelmail @@ -51,113 +51,111 @@ function charset_decode_iso_8859_16 ($string) { if (strtolower($default_charset) == 'iso-8859-16') 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-16')) return $string; $iso8869_16 = 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_16), array_values($iso8859_16), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_2.php b/functions/decode/iso_8859_2.php index da68adcc..cde643bb 100644 --- a/functions/decode/iso_8859_2.php +++ b/functions/decode/iso_8859_2.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,113 +51,111 @@ function charset_decode_iso_8859_2 ($string) { 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; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_3.php b/functions/decode/iso_8859_3.php index b39a3a11..a7410fe8 100644 --- a/functions/decode/iso_8859_3.php +++ b/functions/decode/iso_8859_3.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,106 +51,104 @@ function charset_decode_iso_8859_3 ($string) { if (strtolower($default_charset) == 'iso-8859-3') 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-3')) return $string; $iso8859_3 = array( - "\xA0" => ' ', - "\xA1" => 'Ħ', - "\xA2" => '˘', - "\xA3" => '£', - "\xA4" => '¤', - "\xA6" => 'Ĥ', - "\xA7" => '§', - "\xA8" => '¨', - "\xA9" => 'İ', - "\xAA" => 'Ş', - "\xAB" => 'Ğ', - "\xAC" => 'Ĵ', - "\xAD" => '­', - "\xAF" => 'Ż', - "\xB0" => '°', - "\xB1" => 'ħ', - "\xB2" => '²', - "\xB3" => '³', - "\xB4" => '´', - "\xB5" => 'µ', - "\xB6" => 'ĥ', - "\xB7" => '·', - "\xB8" => '¸', - "\xB9" => 'ı', - "\xBA" => 'ş', - "\xBB" => 'ğ', - "\xBC" => 'ĵ', - "\xBD" => '½', - "\xBF" => 'ż', - "\xC0" => 'À', - "\xC1" => 'Á', - "\xC2" => 'Â', - "\xC4" => 'Ä', - "\xC5" => 'Ċ', - "\xC6" => 'Ĉ', - "\xC7" => 'Ç', - "\xC8" => 'È', - "\xC9" => 'É', - "\xCA" => 'Ê', - "\xCB" => 'Ë', - "\xCC" => 'Ì', - "\xCD" => 'Í', - "\xCE" => 'Î', - "\xCF" => 'Ï', - "\xD1" => 'Ñ', - "\xD2" => 'Ò', - "\xD3" => 'Ó', - "\xD4" => 'Ô', - "\xD5" => 'Ġ', - "\xD6" => 'Ö', - "\xD7" => '×', - "\xD8" => 'Ĝ', - "\xD9" => 'Ù', - "\xDA" => 'Ú', - "\xDB" => 'Û', - "\xDC" => 'Ü', - "\xDD" => 'Ŭ', - "\xDE" => 'Ŝ', - "\xDF" => 'ß', - "\xE0" => 'à', - "\xE1" => 'á', - "\xE2" => 'â', - "\xE4" => 'ä', - "\xE5" => 'ċ', - "\xE6" => 'ĉ', - "\xE7" => 'ç', - "\xE8" => 'è', - "\xE9" => 'é', - "\xEA" => 'ê', - "\xEB" => 'ë', - "\xEC" => 'ì', - "\xED" => 'í', - "\xEE" => 'î', - "\xEF" => 'ï', - "\xF1" => 'ñ', - "\xF2" => 'ò', - "\xF3" => 'ó', - "\xF4" => 'ô', - "\xF5" => 'ġ', - "\xF6" => 'ö', - "\xF7" => '÷', - "\xF8" => 'ĝ', - "\xF9" => 'ù', - "\xFA" => 'ú', - "\xFB" => 'û', - "\xFC" => 'ü', - "\xFD" => 'ŭ', - "\xFE" => 'ŝ', - "\xFF" => '˙' + "\xA0" => ' ', + "\xA1" => 'Ħ', + "\xA2" => '˘', + "\xA3" => '£', + "\xA4" => '¤', + "\xA6" => 'Ĥ', + "\xA7" => '§', + "\xA8" => '¨', + "\xA9" => 'İ', + "\xAA" => 'Ş', + "\xAB" => 'Ğ', + "\xAC" => 'Ĵ', + "\xAD" => '­', + "\xAF" => 'Ż', + "\xB0" => '°', + "\xB1" => 'ħ', + "\xB2" => '²', + "\xB3" => '³', + "\xB4" => '´', + "\xB5" => 'µ', + "\xB6" => 'ĥ', + "\xB7" => '·', + "\xB8" => '¸', + "\xB9" => 'ı', + "\xBA" => 'ş', + "\xBB" => 'ğ', + "\xBC" => 'ĵ', + "\xBD" => '½', + "\xBF" => 'ż', + "\xC0" => 'À', + "\xC1" => 'Á', + "\xC2" => 'Â', + "\xC4" => 'Ä', + "\xC5" => 'Ċ', + "\xC6" => 'Ĉ', + "\xC7" => 'Ç', + "\xC8" => 'È', + "\xC9" => 'É', + "\xCA" => 'Ê', + "\xCB" => 'Ë', + "\xCC" => 'Ì', + "\xCD" => 'Í', + "\xCE" => 'Î', + "\xCF" => 'Ï', + "\xD1" => 'Ñ', + "\xD2" => 'Ò', + "\xD3" => 'Ó', + "\xD4" => 'Ô', + "\xD5" => 'Ġ', + "\xD6" => 'Ö', + "\xD7" => '×', + "\xD8" => 'Ĝ', + "\xD9" => 'Ù', + "\xDA" => 'Ú', + "\xDB" => 'Û', + "\xDC" => 'Ü', + "\xDD" => 'Ŭ', + "\xDE" => 'Ŝ', + "\xDF" => 'ß', + "\xE0" => 'à', + "\xE1" => 'á', + "\xE2" => 'â', + "\xE4" => 'ä', + "\xE5" => 'ċ', + "\xE6" => 'ĉ', + "\xE7" => 'ç', + "\xE8" => 'è', + "\xE9" => 'é', + "\xEA" => 'ê', + "\xEB" => 'ë', + "\xEC" => 'ì', + "\xED" => 'í', + "\xEE" => 'î', + "\xEF" => 'ï', + "\xF1" => 'ñ', + "\xF2" => 'ò', + "\xF3" => 'ó', + "\xF4" => 'ô', + "\xF5" => 'ġ', + "\xF6" => 'ö', + "\xF7" => '÷', + "\xF8" => 'ĝ', + "\xF9" => 'ù', + "\xFA" => 'ú', + "\xFB" => 'û', + "\xFC" => 'ü', + "\xFD" => 'ŭ', + "\xFE" => 'ŝ', + "\xFF" => '˙' ); $string = str_replace(array_keys($iso8859_3), array_values($iso8859_3), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_4.php b/functions/decode/iso_8859_4.php index 2a3100e3..d0044708 100644 --- a/functions/decode/iso_8859_4.php +++ b/functions/decode/iso_8859_4.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,113 +51,111 @@ function charset_decode_iso_8859_4 ($string) { if (strtolower($default_charset) == 'iso-8859-4') 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-4')) return $string; $iso8859_4 = 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_4), array_values($iso8859_4), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_5.php b/functions/decode/iso_8859_5.php index b3a9218b..cbefcb17 100644 --- a/functions/decode/iso_8859_5.php +++ b/functions/decode/iso_8859_5.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,113 +51,111 @@ function charset_decode_iso_8859_5 ($string) { if (strtolower($default_charset) == 'iso-8859-5') 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-5')) return $string; $iso8859_5 = 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_5), array_values($iso8859_5), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_6.php b/functions/decode/iso_8859_6.php index f1b5294c..60c6833f 100644 --- a/functions/decode/iso_8859_6.php +++ b/functions/decode/iso_8859_6.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,68 +51,66 @@ function charset_decode_iso_8859_6 ($string) { if (strtolower($default_charset) == 'iso-8859-6') 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-6')) return $string; $iso8859_6 = array( - "\xA0" => ' ', - "\xA4" => '¤', - "\xAC" => '،', - "\xAD" => '­', - "\xBB" => '؛', - "\xBF" => '؟', - "\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" => 'غ', - "\xE0" => 'ـ', - "\xE1" => 'ف', - "\xE2" => 'ق', - "\xE3" => 'ك', - "\xE4" => 'ل', - "\xE5" => 'م', - "\xE6" => 'ن', - "\xE7" => 'ه', - "\xE8" => 'و', - "\xE9" => 'ى', - "\xEA" => 'ي', - "\xEB" => 'ً', - "\xEC" => 'ٌ', - "\xED" => 'ٍ', - "\xEE" => 'َ', - "\xEF" => 'ُ', - "\xF0" => 'ِ', - "\xF1" => 'ّ', - "\xF2" => 'ْ' + "\xA0" => ' ', + "\xA4" => '¤', + "\xAC" => '،', + "\xAD" => '­', + "\xBB" => '؛', + "\xBF" => '؟', + "\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" => 'غ', + "\xE0" => 'ـ', + "\xE1" => 'ف', + "\xE2" => 'ق', + "\xE3" => 'ك', + "\xE4" => 'ل', + "\xE5" => 'م', + "\xE6" => 'ن', + "\xE7" => 'ه', + "\xE8" => 'و', + "\xE9" => 'ى', + "\xEA" => 'ي', + "\xEB" => 'ً', + "\xEC" => 'ٌ', + "\xED" => 'ٍ', + "\xEE" => 'َ', + "\xEF" => 'ُ', + "\xF0" => 'ِ', + "\xF1" => 'ّ', + "\xF2" => 'ْ' ); $string = str_replace(array_keys($iso8859_6), array_values($iso8859_6), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_7.php b/functions/decode/iso_8859_7.php index 350b559e..b4a0aaa6 100644 --- a/functions/decode/iso_8859_7.php +++ b/functions/decode/iso_8859_7.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,107 +51,105 @@ function charset_decode_iso_8859_7 ($string) { if (strtolower($default_charset) == 'iso-8859-7') 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-7')) return $string; $iso8859_7 = array( - "\xA0" => ' ', - "\xA1" => '‘', - "\xA2" => '’', - "\xA3" => '£', - "\xA6" => '¦', - "\xA7" => '§', - "\xA8" => '¨', - "\xA9" => '©', - "\xAB" => '«', - "\xAC" => '¬', - "\xAD" => '­', - "\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" => 'Ρ', - "\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" => 'ώ' + "\xA0" => ' ', + "\xA1" => '‘', + "\xA2" => '’', + "\xA3" => '£', + "\xA6" => '¦', + "\xA7" => '§', + "\xA8" => '¨', + "\xA9" => '©', + "\xAB" => '«', + "\xAC" => '¬', + "\xAD" => '­', + "\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" => 'Ρ', + "\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" => 'ώ' ); $string = str_replace(array_keys($iso8859_7), array_values($iso8859_7), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_8.php b/functions/decode/iso_8859_8.php index f78dd188..e4abf4fa 100644 --- a/functions/decode/iso_8859_8.php +++ b/functions/decode/iso_8859_8.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,77 +51,75 @@ function charset_decode_iso_8859_8 ($string) { if (strtolower($default_charset) == 'iso8859-8') 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-8')) return $string; $iso8859_8 = array( - "\xA0" => ' ', - "\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" => '¾', - "\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" => 'ת', - "\xFD" => '‎', - "\xFE" => '‏' + "\xA0" => ' ', + "\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" => '¾', + "\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" => 'ת', + "\xFD" => '‎', + "\xFE" => '‏' ); $string = str_replace(array_keys($iso8859_8), array_values($iso8859_8), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_8859_9.php b/functions/decode/iso_8859_9.php index 3cd3b482..6229edc6 100644 --- a/functions/decode/iso_8859_9.php +++ b/functions/decode/iso_8859_9.php @@ -19,21 +19,21 @@ * Authors: Ken Whistler * * 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. * * @version $Id$ * @package squirrelmail @@ -51,113 +51,111 @@ function charset_decode_iso_8859_9 ($string) { if (strtolower($default_charset) == 'iso8859-9') 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-9')) return $string; $iso8859_9 = 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_9), array_values($iso8859_9), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/iso_ir_111.php b/functions/decode/iso_ir_111.php index 0d1473df..d610e86a 100644 --- a/functions/decode/iso_ir_111.php +++ b/functions/decode/iso_ir_111.php @@ -55,113 +55,111 @@ function charset_decode_iso_ir_111 ($string) { if (strtolower($default_charset) == 'iso-ir-111') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* there is no 0x80-0x9F letters in ISO-IR-111 */ - if ( ! ereg("[\241-\377]", $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" => 'Ъ' + "\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; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/koi8_r.php b/functions/decode/koi8_r.php index f23d306a..ef2a1689 100644 --- a/functions/decode/koi8_r.php +++ b/functions/decode/koi8_r.php @@ -50,145 +50,143 @@ function charset_decode_koi8_r ($string) { if (strtolower($default_charset) == 'koi8-r') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $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" => 'Ъ' + "\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; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/koi8_u.php b/functions/decode/koi8_u.php index 06181203..06c11b0c 100644 --- a/functions/decode/koi8_u.php +++ b/functions/decode/koi8_u.php @@ -54,145 +54,143 @@ function charset_decode_koi8_u ($string) { if (strtolower($default_charset) == 'koi8-u') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'koi8-u')) return $string; $koi8u = 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" => 'Ъ' + "\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($koi8u), array_values($koi8u), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/tis_620.php b/functions/decode/tis_620.php index 027e6a12..b4a43c20 100644 --- a/functions/decode/tis_620.php +++ b/functions/decode/tis_620.php @@ -49,113 +49,111 @@ function charset_decode_tis_620 ($string) { if (strtolower($default_charset) == 'tis-620') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* there is no 0x80-0x9F letters in TIS620 */ - if ( ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'tis-620')) return $string; $tis620 = 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($tis620), array_values($tis620), $string); return $string; } - -?> +?> \ No newline at end of file diff --git a/functions/decode/us_ascii.php b/functions/decode/us_ascii.php index de7d7c92..ae96b309 100644 --- a/functions/decode/us_ascii.php +++ b/functions/decode/us_ascii.php @@ -28,7 +28,8 @@ function charset_decode_us_ascii ($string) { if (strtolower($default_charset) == 'us-ascii') return $string; - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'us-ascii')) return $string; $string = preg_replace("/([\201-\237])/e","'?'",$string); @@ -39,4 +40,4 @@ function charset_decode_us_ascii ($string) { $string = preg_replace("/([\241-\377])/e","'?'",$string); return $string; } -?> +?> \ No newline at end of file diff --git a/functions/decode/utf_8.php b/functions/decode/utf_8.php index 8287b515..968f8924 100644 --- a/functions/decode/utf_8.php +++ b/functions/decode/utf_8.php @@ -32,9 +32,8 @@ function charset_decode_utf_8 ($string) { if ($squirrelmail_language == 'ja_JP') return $string; - /* Only do the slow convert if there are 8-bit characters */ - /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ - if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string)) + // don't do decoding when there are no 8bit symbols + if (! sq_is8bit($string,'utf-8')) return $string; // decode three byte unicode characters @@ -49,5 +48,4 @@ function charset_decode_utf_8 ($string) { return $string; } - -?> +?> \ No newline at end of file