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 | |
parent | e1b0851d1aee8feda815510005c4ed9ce88ec5d1 (diff) | |
download | gsoc2013-evolution-f88a537b586a44540327812e3054fdab32bb03a0.tar.gz 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
-rw-r--r-- | camel/ChangeLog | 9 | ||||
-rw-r--r-- | camel/camel-charset-map.c | 4 | ||||
-rw-r--r-- | camel/camel-mime-utils.c | 19 |
3 files changed, 24 insertions, 8 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 46f1f8c2cb..28e367be14 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +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. + 2001-10-02 <NotZed@Ximian.com> * providers/local/camel-maildir-store.c (get_folder_info): Go back diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c index 02ea31a44c..d25cf2cabc 100644 --- a/camel/camel-charset-map.c +++ b/camel/camel-charset-map.c @@ -400,10 +400,6 @@ camel_charset_to_iconv (const char *name) if (name == NULL) return NULL; - /* special-case hack... */ - if (!g_strcasecmp (name, "x-unknown")) - return locale_charset ? locale_charset : "iso-8859-1"; - ICONV_CHARSETS_LOCK (); charset = g_hash_table_lookup (iconv_charsets, name); if (!charset) { 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); } } } |