changeset 80531:d650d458c435

Merge from gnus--rel--5.10 Revision: emacs@sv.gnu.org/emacs--rel--22--patch-259
author Miles Bader <miles@gnu.org>
date Sat, 26 Apr 2008 04:30:32 +0000
parents e2b96c8f8d5e
children 673b1b49aa16 28e6262d77ad
files lisp/gnus/ChangeLog lisp/gnus/mm-encode.el
diffstat 2 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Fri Apr 25 14:30:41 2008 +0000
+++ b/lisp/gnus/ChangeLog	Sat Apr 26 04:30:32 2008 +0000
@@ -1,3 +1,9 @@
+2008-04-24  Luca Capello  <luca@pca.it>  (tiny change)
+
+	* mm-encode.el (mm-safer-encoding): Add optional argument `type'.
+	Don't use QP for message/rfc822.
+	(mm-content-transfer-encoding): Pass `type' to mm-safer-encoding.
+
 2008-04-13  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	[Backport GNKSA related changes from the Gnus trunk.]
--- a/lisp/gnus/mm-encode.el	Fri Apr 25 14:30:41 2008 +0000
+++ b/lisp/gnus/mm-encode.el	Sat Apr 26 04:30:32 2008 +0000
@@ -96,14 +96,19 @@
       "application/octet-stream"
     (mailcap-extension-to-mime (match-string 0 file))))
 
-(defun mm-safer-encoding (encoding)
+(defun mm-safer-encoding (encoding &optional type)
   "Return an encoding similar to ENCODING but safer than it."
   (cond
    ((eq encoding '7bit) '7bit) ;; 7bit is considered safe.
-   ((memq encoding '(8bit quoted-printable)) 'quoted-printable)
+   ((memq encoding '(8bit quoted-printable))
+    ;; According to RFC2046, 5.2.1, RFC822 Subtype, "quoted-printable" is not
+    ;; a valid encoding for message/rfc822:
+    ;; No encoding other than "7bit", "8bit", or "binary" is permitted for the
+    ;; body of a "message/rfc822" entity.
+    (if (string= type "message/rfc822") '8bit 'quoted-printable))
    ;; The remaining encodings are binary and base64 (and perhaps some
    ;; non-standard ones), which are both turned into base64.
-   (t 'base64)))
+   (t (if (string= type "message/rfc822") 'binary 'base64))))
 
 (defun mm-encode-content-transfer-encoding (encoding &optional type)
   "Encode the current buffer with ENCODING for MIME type TYPE.
@@ -178,7 +183,7 @@
 			    (mm-qp-or-base64)
 			  (cadr (car rules)))))
 		   (if mm-use-ultra-safe-encoding
-		       (mm-safer-encoding encoding)
+		       (mm-safer-encoding encoding type)
 		     encoding))))
 	(pop rules)))))