Handling mislabeled emails encoded with Windows-1252
Sebastian Poeplau
sebastian.poeplau at eurecom.fr
Sat Jul 14 05:40:28 PDT 2018
Hi,
This email is to suggest a minor change in how notmuch handles text
encoding when displaying emails. The motivation is the following: I keep
receiving emails that are encoded with Windows-1252 but claim to be
ISOÂ 8859-1. The two character sets only differ in the range between 0x80
and 0x9F where Windows-1252 contains special characters (e.g. âquotation
marksâ) while ISOÂ 8859-1 only has non-printable ones. The mislabeling
thus causes some special characters in such emails to be displayed with
a replacement symbol for non-printable characters.
Of course, it would be best to fix the problem on the sender's side,
making their mail client declare the encoding correctly. However,
sometimes this is just not possible and we need to make do with what we
receive. The change I would thus like to suggest is to always treat
ISOÂ 8859-1 as Windows-1252; since the former only contains non-printable
characters in the range where the two differ, we would not lose any
printable information. According to Wikipedia, this substitution is
common in email clients and browsers because of the frequent
mislabeling [1].
Attached you find a simple patch that illustrates my suggestion. While
it works well for my limited use cases, it's obviously not entirely
reliable. Does anyone have a good idea how to better handle the issue? I
searched GMime for related functionality but didn't quite find what I
was looking for. Do you feel that the issue should be raised with the
GMime people instead?
Best regards,
Sebastian
[1] https://en.wikipedia.org/wiki/ISO/IEC_8859-1#Windows-1252
-------------- next part --------------
A non-text attachment was scrubbed...
Name: charset.patch
Type: text/x-patch
Size: 609 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20180714/fa22c1ce/attachment.bin>
More information about the notmuch
mailing list