Handling mislabeled emails encoded with Windows-1252

Jeffrey Stedfast jestedfa at microsoft.com
Sat Jul 28 05:25:42 PDT 2018

Hi Sebastien,

Yes, that looks good. I would have probably unreffed the null_stream and null_stream_filter inside of that if-block rather than at the end of the function, but that's a stylistic issue that the notmuch authors can comment on. The patch as it stands should work correctly from what I can tell __ 

As an added optimization, you could try limiting that block of code to just when the charset is one of the iso-8859-* charsets.

The following code snippet should help with that:

charset = charset ? g_mime_charset_canon_name (charset) : NULL;
if (wrapper && charset && g_ascii_strncasecmp (charset, "iso-8859-", 9)) {

The reason you need to use g_mime_charset_canon_name (if you decide to add the optimization) is that mail software does not always use the canonical form of the various charset names that they use. Often you will get stuff like "latin1" or "iso_8859-1".

Hope that helps,


On 7/28/18, 7:22 AM, "Sebastian Poeplau" <sebastian.poeplau at eurecom.fr> wrote:

    Hi all,
    Here's the updated patch. It filters the message through the
    GMimeFilterWindows that Jeff mentioned and then uses the charset it
    detects for GMimeFilterCharset in the actual rendering of the message.
    Jeff, is this how to use the filter correctly?

More information about the notmuch mailing list