using sq_is8bit function instead of ereg. Code reuse and fixes some problems
[squirrelmail.git] / functions / decode / iso_8859_1.php
index 6efc59c04714e4824ee111bf9560e5fa20d68101..676122cca9cae07df77d857dec899af93472f0a1 100644 (file)
@@ -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