fix for broken drafts. Patch from Ryan O'Neill
[squirrelmail.git] / functions / i18n.php
index 01f90a2cb9418c709fc654a91f71a9fcab7691fc..d533588c32ca233a8962bc57d2108b7db7bfdb7f 100644 (file)
@@ -435,11 +435,8 @@ function charset_decode_iso_8859_7 ($string) {
      * ISO-8859-7 characters from 11/04 (0xB4) to 11/06 (0xB6)
      * These are Unicode 900-902
      */
-    while (ereg("([\264-\266])", $string, $res)) {
-        $replace = '&#' . (ord($res[1])+720) . ';';
-        $string = str_replace($res[1], $replace, $string);
-    }
-
+    $string = preg_replace("/([\264-\266])/","'&#' . (ord(\\1)+720)",$string);
+    
     /* 11/07 (0xB7) Middle dot is the same in iso-8859-1 */
     $string = str_replace("\267", '·', $string);
 
@@ -447,10 +444,7 @@ function charset_decode_iso_8859_7 ($string) {
      * ISO-8859-7 characters from 11/08 (0xB8) to 11/10 (0xBA)
      * These are Unicode 900-902
      */
-    while (ereg("([\270-\272])", $string, $res)) {
-        $replace = '&#' . (ord($res[1])+720) . ";";
-        $string = str_replace($res[1], $replace, $string);
-    }
+    $string = preg_replace("/([\270-\272])/","'&#' . (ord(\\1)+720)",$string);
 
     /*
      * 11/11 (0xBB) Right angle quotation mark is the same as in
@@ -459,10 +453,7 @@ function charset_decode_iso_8859_7 ($string) {
     $string = str_replace("\273", '»', $string);
 
     /* And now the rest of the charset */
-    while (ereg("([\274-\376])", $string, $res)) {
-        $replace = '&#' . (ord($res[1])+720) . ';';
-        $string = str_replace($res[1], $replace, $string);
-    }
+    $string = preg_replace("/([\274-\376])/","'&#' . (ord(\\1)+720)",$string);
 
     return $string;
 }