GNU bug report logs -
#79376
[PATCH] [WIP] Fix mm multibyte
Previous Next
Full log
View this message in rfc822 format
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>,
>> MORIOKA Tomohiko <morioka <at> jaist.ac.jp>
>> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
>> Date: Wed, 03 Sep 2025 11:33:33 +0200
>>
>> I'm trying to fix an issue in Gnus where some Atom sources (namely
>> planet.emacslife.com/atom.xml, here) are not rendered correctly.
>>
>> This seems to be related to multibyte/unibyte buffer. Here is a minimal
>> exemple to reproduce what I see:
>>
>> --8<---------------cut here---------------start------------->8---
>> (defun my/gen-handle ()
>> (with-current-buffer (get-buffer-create " foo")
>> (erase-buffer)
>> (insert "’…")
>> (list (current-buffer) '("text/html"))))
>>
>> (defun my/test ()
>> (let ((handle (my/gen-handle)))
>> (mm-with-part handle
>> (buffer-string))))
>> --8<---------------cut here---------------end--------------->8---
>>
>> When evaluating (my/test), see that the buffer string content does not
>> have the correct characters.
>
> Hmm... I'm not familiar with this code, but the comment in
> mm-with-part says:
>
> ;; The handle-buffer's content is a sequence of bytes, not a sequence of
> ;; chars, so the buffer should be unibyte. It may happen that the
> ;; handle-buffer is multibyte for some reason, in which case now is a good
> ;; time to adjust it, since we know at this point that it should
> ;; be unibyte.
>
> But your test case inserts a multibyte string into the buffer, so
> aren't you violating what this macro expects and should handle?
Yes, I've seen this comment and I do think that I'm violating what is
expected here… but then so does `mm-shr' (in my example trying to read
"planet.emacslife.com/atom.xml").
> And also, is a call to buffer-string something that this macro's body
> is useful for?
In mm-decode.el:1903, there is the following code:
(decode-coding-string (buffer-string) coding)
> Apologies if I'm not making sense.
No, I think you're perfectly on point.
--
Manuel Giraud
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.