Handling mislabeled emails encoded with Windows-1252

Sebastian Poeplau sebastian.poeplau at eurecom.fr
Mon Jul 30 00:28:57 PDT 2018


> 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 __

I was worried about the string returned by
g_mime_filter_windows_real_charset: once I unref everything, isn't there
a risk of the filter being deleted? As far as I can tell from the code,
the returned charset might be a pointer into the filter object...

> 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".

Nice, I'll add it.

Thanks a lot,

More information about the notmuch mailing list