Browse Source

Fixed bug #230696: subject line decoded wrong. A problem when uppercasing
QuotedPrintable.

gustavf 24 years ago
parent
commit
59bca7a7be
1 changed files with 4 additions and 3 deletions
  1. 4 3
      functions/mime.php

+ 4 - 3
functions/mime.php

@@ -700,7 +700,7 @@
             $replace = ereg_replace("_", " ", $res[3]);
 	    // Convert lowercase Quoted Printable to uppercase for
 	    // quoted_printable_decode to understand it.
-	    while (ereg("(=([0-9][abcdef])|([abcdef][0-9])|([abcdef][abcdef]))", $replace, $res)) {
+	    while (ereg("(=(([0-9][abcdef])|([abcdef][0-9])|([abcdef][abcdef])))", $replace, $res)) {
 	       $replace = str_replace($res[1], strtoupper($res[1]), $replace);
 	    }
             $replace = quoted_printable_decode($replace);
@@ -708,9 +708,10 @@
 
          $replace = charset_decode ($res[1], $replace);
 
-         $string = eregi_replace
-            ('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=',
+         // Remove the name of the character set.
+         $string = eregi_replace ('=\\?([^?]+)\\?(q|b)\\?([^?]+)\\?=',
              $replace, $string);
+
          // In case there should be more encoding in the string: recurse
          return (decodeHeader($string));
       } else