<?php
+
/**
* decode/iso8859-7.php
- * $Id$
- *
- * Copyright (c) 2003-2004 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This file contains iso-8859-7 decoding function that is needed to read
* iso-8859-7 encoded mails in non-iso-8859-7 locale.
- *
+ *
* Original data taken from:
* ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT
*
* Authors: Ken Whistler <kenw@sybase.com>
*
* Original copyright:
- * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
+ * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
+ *
+ * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+ * No claims are made as to fitness for any particular purpose. No
+ * warranties of any kind are expressed or implied. The recipient
+ * agrees to determine applicability of information provided. If this
+ * file has been provided on optical media by Unicode, Inc., the sole
+ * remedy for any claim will be exchange of defective media within 90
+ * days of receipt.
*
- * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
- * No claims are made as to fitness for any particular purpose. No
- * warranties of any kind are expressed or implied. The recipient
- * agrees to determine applicability of information provided. If this
- * file has been provided on optical media by Unicode, Inc., the sole
- * remedy for any claim will be exchange of defective media within 90
- * days of receipt.
+ * Unicode, Inc. hereby grants the right to freely use the information
+ * supplied in this file in the creation of products supporting the
+ * Unicode Standard, and to make copies of this file in any form for
+ * internal or external distribution as long as this notice remains
+ * attached.
*
- * Unicode, Inc. hereby grants the right to freely use the information
- * supplied in this file in the creation of products supporting the
- * Unicode Standard, and to make copies of this file in any form for
- * internal or external distribution as long as this notice remains
- * attached.
+ * @copyright 2003-2018 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
* @package squirrelmail
* @subpackage decode
*/
* @return string $string Decoded string
*/
function charset_decode_iso_8859_7 ($string) {
- global $default_charset;
-
- 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;
}
-
-?>