Synch with Oort Gnus.
[elisp/gnus.git-] / lisp / mm-encode.el
index 134d67e..b56c569 100644 (file)
@@ -1,5 +1,5 @@
-;;; mm-encode.el --- Functions for encoding MIME things 
-;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+;;; mm-encode.el --- Functions for encoding MIME things
+;; Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
@@ -36,7 +36,7 @@
     ("message/rfc822" 8bit)
     ("application/emacs-lisp" 8bit)
     ("application/x-patch" 8bit)
-    (".*" qp-or-base64))
+    (".*" base64))
   "Alist of regexps that match MIME types and their encodings.
 If the encoding is `qp-or-base64', then either quoted-printable
 or base64 will be used, depending on what is more efficient.")
@@ -85,7 +85,8 @@ This variable should never be set directly, but bound before a call to
 (defun mm-encode-content-transfer-encoding (encoding &optional type)
   (cond
    ((eq encoding 'quoted-printable)
-    (quoted-printable-encode-region (point-min) (point-max) t))
+    (mm-with-unibyte-current-buffer-mule4
+      (quoted-printable-encode-region (point-min) (point-max) t)))
    ((eq encoding 'base64)
     (when (equal type "text/plain")
       (goto-char (point-min))
@@ -118,7 +119,8 @@ The encoding used is returned."
         (bits (mm-body-7-or-8)))
     ;; We force buffers that are 7bit to be unencoded, no matter
     ;; what the preferred encoding is.
-    (when (eq bits '7bit)
+    ;; Only if the buffers don't contain lone lines.
+    (when (and (eq bits '7bit) (not (mm-long-lines-p 76)))
       (setq encoding bits))
     (mm-encode-content-transfer-encoding encoding mime-type)
     encoding))
@@ -143,7 +145,7 @@ The encoding used is returned."
       (while rules
        (when (string-match (caar rules) type)
          (throw 'found
-                (let ((encoding 
+                (let ((encoding
                        (if (eq (cadr (car rules)) 'qp-or-base64)
                            (mm-qp-or-base64)
                          (cadr (car rules)))))