using sq_is8bit function instead of ereg. Code reuse and fixes some problems
[squirrelmail.git] / functions / decode / cp1254.php
index fc809ae28fc1fa9d20d2913b7aaac386fe0233d5..10916c0a61360a7bae1f8dc79b6afed176806790 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 /**
  * decode/cp1254.php
- * $Id$
  *
  * Copyright (c) 2003-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
@@ -18,6 +17,8 @@
  *   Table format:  Format A
  *   Date:          04/15/98
  *   Contact:       cpxlate@microsoft.com
+ *
+ * @version $Id$
  * @package squirrelmail
  * @subpackage decode
  */
@@ -33,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(