]> git.mjollnir.org Git - moodle.git/commitdiff
Now encode_mimeheader() only encodes the header if it isn't 100% ASCII.
authorstronk7 <stronk7>
Sun, 19 Mar 2006 02:38:21 +0000 (02:38 +0000)
committerstronk7 <stronk7>
Sun, 19 Mar 2006 02:38:21 +0000 (02:38 +0000)
lib/textlib.class.php

index 1e772027213a9958f18a15a40f1f9fc4a03ba218..2c2012558b86ec952e05d294fd279b2d612bd557 100644 (file)
@@ -193,6 +193,10 @@ class textlib {
      * paravoid (http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283).
      */
     function encode_mimeheader($text, $charset='utf-8') {
+    /// If the text is pure ASCII, we don't need to encode it
+        if ($this->convert($text, $charset, 'ascii') == $text) {
+            return $text;
+        }
     /// Although RFC says that line feed should be \r\n, it seems that
     /// some mailers double convert \r, so we are going to use \n alone
         $linefeed="\n";