diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-01-07 15:12:23 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-01-07 15:12:23 +0100 |
commit | 23a887e426f81033b0de2f4c93a8525cb31c28da (patch) | |
tree | 0452fad530ffb6289aa00654fe085b5ea6a71b4f /lisp/gnus/mm-decode.el | |
parent | 7e80aecc248a78eab923005b266c939c18936c1b (diff) | |
download | emacs-23a887e426f81033b0de2f4c93a8525cb31c28da.tar.gz |
Add work-around for nnmaildir encoding problem
* lisp/gnus/mm-decode.el (mm-with-part): Fix problem with
multipart 8bit encoded posts from nnmaildir (bug#44307).
Diffstat (limited to 'lisp/gnus/mm-decode.el')
-rw-r--r-- | lisp/gnus/mm-decode.el | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 61946aa5811..2b0b61bfac6 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1264,11 +1264,20 @@ in HANDLE." (when (and (mm-handle-buffer handle) (buffer-name (mm-handle-buffer handle))) (with-temp-buffer - (mm-disable-multibyte) - (insert-buffer-substring (mm-handle-buffer handle)) - (mm-decode-content-transfer-encoding - (mm-handle-encoding handle) - (mm-handle-media-type handle)) + (if (and (eq (mm-handle-encoding handle) '8bit) + (with-current-buffer (mm-handle-buffer handle) + enable-multibyte-characters)) + ;; Due to unfortunate historical reasons, we may have a + ;; multibyte buffer here, but if it's using an 8bit + ;; Content-Transfer-Encoding, then work around that by + ;; just ignoring the situation. + (insert-buffer-substring (mm-handle-buffer handle)) + ;; Do the decoding. + (mm-disable-multibyte) + (insert-buffer-substring (mm-handle-buffer handle)) + (mm-decode-content-transfer-encoding + (mm-handle-encoding handle) + (mm-handle-media-type handle))) ,@forms)))) (put 'mm-with-part 'lisp-indent-function 1) (put 'mm-with-part 'edebug-form-spec '(body)) |