From c05f1020cecb4ef7d516e6575c86bf009c2e6f00 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 6 Aug 2020 16:47:21 +0200 Subject: [PATCH] Tweat how MML specifies the encoding of binary data * lisp/gnus/mml.el (mml-parse-1): Use `data-encoding' to be slightly less confusing than `content-transfer-encoding'. * doc/misc/emacs-mime.texi (MML Definition): Document it. * lisp/gnus/message.el (message-insert-screenshot): Adjust usage. --- doc/misc/emacs-mime.texi | 13 +++++++++++-- lisp/gnus/message.el | 2 +- lisp/gnus/mml.el | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index 974cc10458d..9180b4ec205 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -693,8 +693,17 @@ Valid values are @samp{inline} and @samp{attachment} @item encoding Valid values are @samp{7bit}, @samp{8bit}, @samp{quoted-printable} and -@samp{base64} (@code{Content-Transfer-Encoding}). @xref{Charset -Translation}. +@samp{base64}. @xref{Charset +Translation}. This parameter says what +@code{Content-Transfer-Encoding} to use when sending the part, and is +normally computed automatically. + +@item data-encoding +This parameter says what encoding has been used on the data, and the +data will be decoded before use. Valid values are +@samp{quoted-printable} and @samp{base64}. This is useful when you +have a part with binary data (for instance an image) inserted directly +into the Message buffer inside the @samp{"<#part>...<#/part>"} tags. @item description A description of the part (@code{Content-Description}). diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 6c0f9b5c9ba..819f3e41d3d 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8709,7 +8709,7 @@ used to take the screenshot." :max-width (truncate (* (frame-pixel-width) 0.8)) :max-height (truncate (* (frame-pixel-height) 0.8)) :scale 1) - (format "<#part type=\"image/png\" disposition=inline content-transfer-encoding=base64 raw=t>\n%s\n<#/part>" + (format "<#part type=\"image/png\" disposition=inline data-encoding=base64 raw=t>\n%s\n<#/part>" ;; Get a base64 version of the image -- this avoids later ;; complications if we're auto-saving the buffer and ;; restoring from a file. diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 1d348f3a6f0..ef8aa6ac019 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -298,12 +298,12 @@ part. This is for the internal use, you should never modify the value.") ;; We have a part that already has a transfer encoding. Undo ;; that so that we don't double-encode later. (when (and raw - (cdr (assq 'content-transfer-encoding tag))) + (cdr (assq 'data-encoding tag))) (with-temp-buffer (set-buffer-multibyte nil) (insert contents) (mm-decode-content-transfer-encoding - (intern (cdr (assq 'content-transfer-encoding tag))) + (intern (cdr (assq 'data-encoding tag))) (cdr (assq 'type tag))) (setq contents (buffer-string)))) (when (and (not raw) (memq nil charsets)) -- 2.39.2