aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/gnus/mm-encode.el
diff options
context:
space:
mode:
authorMiles Bader2008-04-26 04:29:42 +0000
committerMiles Bader2008-04-26 04:29:42 +0000
commit58a67d68bfc2eafe0cd029aa33693228f21f4e51 (patch)
tree009923ba472fb824796a3cd59f91925c17ee8c5b /lisp/gnus/mm-encode.el
parent1ea193a2b6414ac6186de0840e5b734c7d82a810 (diff)
downloademacs-58a67d68bfc2eafe0cd029aa33693228f21f4e51.tar.gz
emacs-58a67d68bfc2eafe0cd029aa33693228f21f4e51.zip
Merge from gnus--devo--0
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1128
Diffstat (limited to 'lisp/gnus/mm-encode.el')
-rw-r--r--lisp/gnus/mm-encode.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/gnus/mm-encode.el b/lisp/gnus/mm-encode.el
index 2597a5d5d97..3dce8d1920f 100644
--- a/lisp/gnus/mm-encode.el
+++ b/lisp/gnus/mm-encode.el
@@ -96,14 +96,19 @@ This variable should never be set directly, but bound before a call to
96 "application/octet-stream" 96 "application/octet-stream"
97 (mailcap-extension-to-mime (match-string 0 file)))) 97 (mailcap-extension-to-mime (match-string 0 file))))
98 98
99(defun mm-safer-encoding (encoding) 99(defun mm-safer-encoding (encoding &optional type)
100 "Return an encoding similar to ENCODING but safer than it." 100 "Return an encoding similar to ENCODING but safer than it."
101 (cond 101 (cond
102 ((eq encoding '7bit) '7bit) ;; 7bit is considered safe. 102 ((eq encoding '7bit) '7bit) ;; 7bit is considered safe.
103 ((memq encoding '(8bit quoted-printable)) 'quoted-printable) 103 ((memq encoding '(8bit quoted-printable))
104 ;; According to RFC2046, 5.2.1, RFC822 Subtype, "quoted-printable" is not
105 ;; a valid encoding for message/rfc822:
106 ;; No encoding other than "7bit", "8bit", or "binary" is permitted for the
107 ;; body of a "message/rfc822" entity.
108 (if (string= type "message/rfc822") '8bit 'quoted-printable))
104 ;; The remaining encodings are binary and base64 (and perhaps some 109 ;; The remaining encodings are binary and base64 (and perhaps some
105 ;; non-standard ones), which are both turned into base64. 110 ;; non-standard ones), which are both turned into base64.
106 (t 'base64))) 111 (t (if (string= type "message/rfc822") 'binary 'base64))))
107 112
108(defun mm-encode-content-transfer-encoding (encoding &optional type) 113(defun mm-encode-content-transfer-encoding (encoding &optional type)
109 "Encode the current buffer with ENCODING for MIME type TYPE. 114 "Encode the current buffer with ENCODING for MIME type TYPE.
@@ -178,7 +183,7 @@ The encoding used is returned."
178 (mm-qp-or-base64) 183 (mm-qp-or-base64)
179 (cadr (car rules))))) 184 (cadr (car rules)))))
180 (if mm-use-ultra-safe-encoding 185 (if mm-use-ultra-safe-encoding
181 (mm-safer-encoding encoding) 186 (mm-safer-encoding encoding type)
182 encoding)))) 187 encoding))))
183 (pop rules))))) 188 (pop rules)))))
184 189