diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-10-03 07:32:14 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-10-03 07:32:14 +0800 |
commit | f88a537b586a44540327812e3054fdab32bb03a0 (patch) | |
tree | 786998a953d25932f7ee37c25f89515b2d7b44be /camel/camel-mime-utils.c | |
parent | e1b0851d1aee8feda815510005c4ed9ce88ec5d1 (diff) | |
download | gsoc2013-evolution-f88a537b586a44540327812e3054fdab32bb03a0.tar gsoc2013-evolution-f88a537b586a44540327812e3054fdab32bb03a0.tar.gz gsoc2013-evolution-f88a537b586a44540327812e3054fdab32bb03a0.tar.bz2 gsoc2013-evolution-f88a537b586a44540327812e3054fdab32bb03a0.tar.lz gsoc2013-evolution-f88a537b586a44540327812e3054fdab32bb03a0.tar.xz gsoc2013-evolution-f88a537b586a44540327812e3054fdab32bb03a0.tar.zst gsoc2013-evolution-f88a537b586a44540327812e3054fdab32bb03a0.zip |
Revert my x-unknown special-case hack - this may mask other problems.
2001-10-02 Jeffrey Stedfast <fejj@ximian.com>
* camel-charset-map.c (camel_charset_to_iconv): Revert my
x-unknown special-case hack - this may mask other problems.
* camel-mime-utils.c (rfc2047_decode_word): If the iconv
conversion fails, for whatever reason, retry using the user's
locale charset.
svn path=/trunk/; revision=13359
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r-- | camel/camel-mime-utils.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 3498a9fd74..aed930eca5 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -913,8 +913,9 @@ rfc2047_decode_word(const char *in, int len) char *outbase = NULL; char *outbuf; int inlen, outlen; + gboolean retried = FALSE; iconv_t ic; - + d(printf("rfc2047: decoding '%.*s'\n", len, in)); /* quick check to see if this could possibly be a real encoded word */ @@ -963,6 +964,7 @@ rfc2047_decode_word(const char *in, int len) outbuf = outbase; /* TODO: Should this cache iconv converters? */ + retry: ic = iconv_open ("UTF-8", charset); if (ic != (iconv_t)-1) { ret = iconv (ic, &inbuf, &inlen, &outbuf, &outlen); @@ -975,9 +977,18 @@ rfc2047_decode_word(const char *in, int len) } else { w(g_warning ("Cannot decode charset, header display may be corrupt: %s: %s", charset, g_strerror (errno))); - /* TODO: Should this do this, or just leave the encoded strings? */ - decword[inlen] = 0; - decoded = g_strdup (decword); + + if (!retried) { + charset = camel_charset_locale_name (); + if (!charset) + charset = "iso-8859-1"; + + retried = TRUE; + goto retry; + } + + /* we return the encoded word here because we've got to return valid utf8 */ + decoded = g_strndup (in, inlen); } } } |