X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fdecode%2Fiso_8859_6.php;h=a7201503968113d4b4a63ad2afc786eed2423e14;hp=f1b5294c3a9135bbc08029de315f18aca25e2695;hb=91e0dccca7b2452d8b450791cae3aa4125e8889e;hpb=31841a9ece7cc2ae90bf52dd92db68142172a47b diff --git a/functions/decode/iso_8859_6.php b/functions/decode/iso_8859_6.php index f1b5294c..a7201503 100644 --- a/functions/decode/iso_8859_6.php +++ b/functions/decode/iso_8859_6.php @@ -7,7 +7,7 @@ * * This file contains iso-8859-6 decoding function that is needed to read * iso-8859-6 encoded mails in non-iso-8859-6 locale. - * + * * Original data taken from: * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-6.TXT * @@ -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