Happy New Year
[squirrelmail.git] / functions / decode / iso_8859_10.php
index c8e0d07a831cfe3e9b6bfda8f1c0c6ae47e968f3..ced58c269019e4956df1df72a87b9e2d3132b721 100644 (file)
@@ -1,14 +1,11 @@
 <?php
+
 /**
  * decode/iso8859-10.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-10 decoding function that is needed to read
  * iso-8859-10 encoded mails in non-iso-8859-10 locale.
- * 
+ *
  * Original data taken from:
  *  ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-10.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-2020 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_10 ($string) {
-    global $default_charset;
-
-    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" => '&#160;',
-       "\xA1" => '&#260;',
-       "\xA2" => '&#274;',
-       "\xA3" => '&#290;',
-       "\xA4" => '&#298;',
-       "\xA5" => '&#296;',
-       "\xA6" => '&#310;',
-       "\xA7" => '&#167;',
-       "\xA8" => '&#315;',
-       "\xA9" => '&#272;',
-       "\xAA" => '&#352;',
-       "\xAB" => '&#358;',
-       "\xAC" => '&#381;',
-       "\xAD" => '&#173;',
-       "\xAE" => '&#362;',
-       "\xAF" => '&#330;',
-       "\xB0" => '&#176;',
-       "\xB1" => '&#261;',
-       "\xB2" => '&#275;',
-       "\xB3" => '&#291;',
-       "\xB4" => '&#299;',
-       "\xB5" => '&#297;',
-       "\xB6" => '&#311;',
-       "\xB7" => '&#183;',
-       "\xB8" => '&#316;',
-       "\xB9" => '&#273;',
-       "\xBA" => '&#353;',
-       "\xBB" => '&#359;',
-       "\xBC" => '&#382;',
-       "\xBD" => '&#8213;',
-       "\xBE" => '&#363;',
-       "\xBF" => '&#331;',
-       "\xC0" => '&#256;',
-       "\xC1" => '&#193;',
-       "\xC2" => '&#194;',
-       "\xC3" => '&#195;',
-       "\xC4" => '&#196;',
-       "\xC5" => '&#197;',
-       "\xC6" => '&#198;',
-       "\xC7" => '&#302;',
-       "\xC8" => '&#268;',
-       "\xC9" => '&#201;',
-       "\xCA" => '&#280;',
-       "\xCB" => '&#203;',
-       "\xCC" => '&#278;',
-       "\xCD" => '&#205;',
-       "\xCE" => '&#206;',
-       "\xCF" => '&#207;',
-       "\xD0" => '&#208;',
-       "\xD1" => '&#325;',
-       "\xD2" => '&#332;',
-       "\xD3" => '&#211;',
-       "\xD4" => '&#212;',
-       "\xD5" => '&#213;',
-       "\xD6" => '&#214;',
-       "\xD7" => '&#360;',
-       "\xD8" => '&#216;',
-       "\xD9" => '&#370;',
-       "\xDA" => '&#218;',
-       "\xDB" => '&#219;',
-       "\xDC" => '&#220;',
-       "\xDD" => '&#221;',
-       "\xDE" => '&#222;',
-       "\xDF" => '&#223;',
-       "\xE0" => '&#257;',
-       "\xE1" => '&#225;',
-       "\xE2" => '&#226;',
-       "\xE3" => '&#227;',
-       "\xE4" => '&#228;',
-       "\xE5" => '&#229;',
-       "\xE6" => '&#230;',
-       "\xE7" => '&#303;',
-       "\xE8" => '&#269;',
-       "\xE9" => '&#233;',
-       "\xEA" => '&#281;',
-       "\xEB" => '&#235;',
-       "\xEC" => '&#279;',
-       "\xED" => '&#237;',
-       "\xEE" => '&#238;',
-       "\xEF" => '&#239;',
-       "\xF0" => '&#240;',
-       "\xF1" => '&#326;',
-       "\xF2" => '&#333;',
-       "\xF3" => '&#243;',
-       "\xF4" => '&#244;',
-       "\xF5" => '&#245;',
-       "\xF6" => '&#246;',
-       "\xF7" => '&#361;',
-       "\xF8" => '&#248;',
-       "\xF9" => '&#371;',
-       "\xFA" => '&#250;',
-       "\xFB" => '&#251;',
-       "\xFC" => '&#252;',
-       "\xFD" => '&#253;',
-       "\xFE" => '&#254;',
-       "\xFF" => '&#312;'
+        "\xA0" => '&#160;',
+        "\xA1" => '&#260;',
+        "\xA2" => '&#274;',
+        "\xA3" => '&#290;',
+        "\xA4" => '&#298;',
+        "\xA5" => '&#296;',
+        "\xA6" => '&#310;',
+        "\xA7" => '&#167;',
+        "\xA8" => '&#315;',
+        "\xA9" => '&#272;',
+        "\xAA" => '&#352;',
+        "\xAB" => '&#358;',
+        "\xAC" => '&#381;',
+        "\xAD" => '&#173;',
+        "\xAE" => '&#362;',
+        "\xAF" => '&#330;',
+        "\xB0" => '&#176;',
+        "\xB1" => '&#261;',
+        "\xB2" => '&#275;',
+        "\xB3" => '&#291;',
+        "\xB4" => '&#299;',
+        "\xB5" => '&#297;',
+        "\xB6" => '&#311;',
+        "\xB7" => '&#183;',
+        "\xB8" => '&#316;',
+        "\xB9" => '&#273;',
+        "\xBA" => '&#353;',
+        "\xBB" => '&#359;',
+        "\xBC" => '&#382;',
+        "\xBD" => '&#8213;',
+        "\xBE" => '&#363;',
+        "\xBF" => '&#331;',
+        "\xC0" => '&#256;',
+        "\xC1" => '&#193;',
+        "\xC2" => '&#194;',
+        "\xC3" => '&#195;',
+        "\xC4" => '&#196;',
+        "\xC5" => '&#197;',
+        "\xC6" => '&#198;',
+        "\xC7" => '&#302;',
+        "\xC8" => '&#268;',
+        "\xC9" => '&#201;',
+        "\xCA" => '&#280;',
+        "\xCB" => '&#203;',
+        "\xCC" => '&#278;',
+        "\xCD" => '&#205;',
+        "\xCE" => '&#206;',
+        "\xCF" => '&#207;',
+        "\xD0" => '&#208;',
+        "\xD1" => '&#325;',
+        "\xD2" => '&#332;',
+        "\xD3" => '&#211;',
+        "\xD4" => '&#212;',
+        "\xD5" => '&#213;',
+        "\xD6" => '&#214;',
+        "\xD7" => '&#360;',
+        "\xD8" => '&#216;',
+        "\xD9" => '&#370;',
+        "\xDA" => '&#218;',
+        "\xDB" => '&#219;',
+        "\xDC" => '&#220;',
+        "\xDD" => '&#221;',
+        "\xDE" => '&#222;',
+        "\xDF" => '&#223;',
+        "\xE0" => '&#257;',
+        "\xE1" => '&#225;',
+        "\xE2" => '&#226;',
+        "\xE3" => '&#227;',
+        "\xE4" => '&#228;',
+        "\xE5" => '&#229;',
+        "\xE6" => '&#230;',
+        "\xE7" => '&#303;',
+        "\xE8" => '&#269;',
+        "\xE9" => '&#233;',
+        "\xEA" => '&#281;',
+        "\xEB" => '&#235;',
+        "\xEC" => '&#279;',
+        "\xED" => '&#237;',
+        "\xEE" => '&#238;',
+        "\xEF" => '&#239;',
+        "\xF0" => '&#240;',
+        "\xF1" => '&#326;',
+        "\xF2" => '&#333;',
+        "\xF3" => '&#243;',
+        "\xF4" => '&#244;',
+        "\xF5" => '&#245;',
+        "\xF6" => '&#246;',
+        "\xF7" => '&#361;',
+        "\xF8" => '&#248;',
+        "\xF9" => '&#371;',
+        "\xFA" => '&#250;',
+        "\xFB" => '&#251;',
+        "\xFC" => '&#252;',
+        "\xFD" => '&#253;',
+        "\xFE" => '&#254;',
+        "\xFF" => '&#312;'
     );
 
     $string = str_replace(array_keys($iso8859_10), array_values($iso8859_10), $string);
 
     return $string;
 }
-
-?>