In case the header is not 7bit clean, gtk20 has problems displaying it

correctly (because then it is not utf8 valid as well)
Force converting the header and the xover data (usenet) to utf-8 in case
it isn't 7bit clean by assuming the header was written in the charset
locale(1) reports. That might be wrong, but I see no other way.
We can't detect the charset in which the header was written in (for
example, xover data doesn't have any informations in it about content-type)
because Content-Type only affecty the message-body.

Approved By:	maintainer (implicit)
Taken From:	sylpheed-claws gtk2 CVS branch
This commit is contained in:
Oliver Lehmann 2004-10-21 20:47:59 +00:00
parent abbe3539ea
commit 40d3a64ef2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=119925

View File

@ -20,3 +20,27 @@
if (conv_str) {
len = strlen(conv_str);
memcpy(outp, conv_str, len);
--- src/codeconv.c.orig Thu Oct 21 22:08:15 2004
+++ src/codeconv.c Thu Oct 21 22:08:34 2004
@@ -1651,8 +1651,20 @@
Xalloca(buf, buflen, return);
conv_anytodisp(buf, buflen, str);
unmime_header(outbuf, buf);
- } else
+ } else {
+ gchar *tmp;
unmime_header(outbuf, str);
+ if (outbuf && !g_utf8_validate(outbuf, -1, NULL)) {
+ tmp = conv_codeset_strdup(outbuf,
+ conv_get_current_charset_str(),
+ CS_UTF_8);
+ if (tmp) {
+ strncpy(outbuf, tmp, outlen-1);
+ g_free(tmp);
+ }
+ }
+ }
+
}
#define MAX_LINELEN 76