emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/gnus/mm-encode.el, v [EMACS_22_BASE]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/gnus/mm-encode.el, v [EMACS_22_BASE]
Date: Sat, 26 Apr 2008 04:30:33 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         EMACS_22_BASE
Changes by:     Miles Bader <miles>     08/04/26 04:30:32

Index: mm-encode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/gnus/mm-encode.el,v
retrieving revision 1.15.2.2
retrieving revision 1.15.2.3
diff -u -b -r1.15.2.2 -r1.15.2.3
--- mm-encode.el        7 Jan 2008 01:22:40 -0000       1.15.2.2
+++ mm-encode.el        26 Apr 2008 04:30:32 -0000      1.15.2.3
@@ -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)))))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]