Index: camel/ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/camel/ChangeLog,v retrieving revision 1.2146 diff -u -3 -r1.2146 ChangeLog --- camel/ChangeLog 24 May 2004 08:02:10 -0000 1.2146 +++ camel/ChangeLog 24 May 2004 11:18:50 -0000 @@ -1,5 +1,11 @@ 2004-05-24 Not Zed + * camel-mime-utils.c (header_decode_text): Crap interoperability + fix for a crap interoperability problem with BROKEN emailers. + Totally untested. See #58555. + +2004-05-24 Not Zed + * camel-mime-utils.c (camel_header_newsgroups_decode): fix/rearrange logic. It was using the wrong working pointer. Index: camel/camel-mime-utils.c =================================================================== RCS file: /cvs/gnome/evolution/camel/camel-mime-utils.c,v retrieving revision 1.208 diff -u -3 -r1.208 camel-mime-utils.c --- camel/camel-mime-utils.c 24 May 2004 08:02:10 -0000 1.208 +++ camel/camel-mime-utils.c 24 May 2004 11:18:52 -0000 @@ -1147,18 +1147,38 @@ while (inptr < inend && !camel_mime_is_lwsp(*inptr)) inptr++; - dword = rfc2047_decode_word(start, inptr-start); - if (dword) { - g_string_append(out, dword); - g_free(dword); - } else { + /* interofuxedability fix for non rfc compliant i18n mailers */ + do { + const char *enc, *end; + + enc = strstr(start, "=?"); + if (enc + && enc < inptr) { + if (enc == start + && (end = strstr(enc+2, "?=")) + && end < (inptr-2) + && (dword = rfc2047_decode_word(start, end-start+2))) { + g_string_append(out, dword); + g_free(dword); + start = end + 2; + chunk = start; + continue; + } else { + end = enc; + } + } else { + end = inptr; + } + if (!chunk) chunk = start; - if ((default_charset == NULL || !append_8bit (out, chunk, inptr-chunk, default_charset)) - && (locale_charset == NULL || !append_8bit(out, chunk, inptr-chunk, locale_charset))) - append_latin1(out, chunk, inptr-chunk); - } + if ((default_charset == NULL || !append_8bit (out, chunk, end-chunk, default_charset)) + && (locale_charset == NULL || !append_8bit(out, chunk, end-chunk, locale_charset))) + append_latin1(out, chunk, end-chunk); + + start = end; + } while (start < inptr); chunk = NULL; }