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.
This commit is contained in:
Lars Ingebrigtsen 2020-08-06 16:47:21 +02:00
parent d3fabff99d
commit c05f1020ce
3 changed files with 14 additions and 5 deletions

View file

@ -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}).

View file

@ -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.

View file

@ -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))