Subject: bug#44307: 27.1; UTF-8 parts transferred as 8bit in multipart messages fail to decode

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 07 Jan 2021 17:10:22 +0100

Alexandre Duret-Lutz <[email-masked]> writes:

> Question: shouldn't mm-with-part always leave the buffer in unibyte
> mode?  The comment at the beginning of the macro seems to suggest that,
> but the new "if" does not call (mm-disable-multibyte) after inserting
> the part.

Hm, true.

> -            (insert-buffer-substring (mm-handle-buffer handle))
> +            (progn
> +              (insert-buffer-substring (mm-handle-buffer handle))
> +              (mm-disable-multibyte))

No, disabling multibyte in a non-empty buffer is always the wrong thing
to do -- using encode-coding-region is probably the thing to do here.

>            ;; Do the decoding.
>            (mm-disable-multibyte)
>            (insert-buffer-substring (mm-handle-buffer handle))
>
> this seems to fix text/plain utf-8 parts as well, however the
> rendering of window-1252 parts is now broken...

Yeah, that's to be expected.

Could you forward a message with a windows-1252 part, too (like the
previous one), and I can add it to the test cases.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no