[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RMAIL mis-unquoting qp
From: |
Eli Zaretskii |
Subject: |
RMAIL mis-unquoting qp |
Date: |
Sun, 07 Mar 2004 00:11:11 +0200 |
There's a subtle bug in rmail-convert-to-babyl-format: if the message
is sent in quoted-printable encoding, some of the qp-encoded
characters aren't decoded correctly (instead of a single character
from each "=XX" group, you get two characters from some of them).
I think this began to happen since rmail-decode-quoted-printable was
replaced with mail-unquote-printable-region (RMAIL calls
mail-unquote-printable-region to decode qp).
mail-unquote-printable-region uses make-string to create the decoded
text, and then inserts it into the buffer, but it doesn't make the
buffer unibyte before the insertion. This causes some of the decoded
characters be converted to multibyte characters (which ones exactly,
depends on how the default coding systems are set), and the subsequent
decode-coding-region desn't DTRT.
Here's a test case:
emacs -q
M-: (insert (mail-unquote-printable "'=D8' and '=F8'")) RET
M-<
M->
M-: (decode-coding-region (mark) (point) 'latin-1) RET
You should now see 2 characters instead of one where "=F8" was
originally.
I'm not sure how to solve this in the cleanest way. Toggling
multibyteness of the buffer should work, but it's expensive for large
messages. I actually feel that make-string is not a good way of
producing unibyte strings with arbitrary bytes, so perhaps a cleaner
way would be to fix mail-unquote-printable-region so that it produces
unibyte strings.
- RMAIL mis-unquoting qp,
Eli Zaretskii <=