diff options
Diffstat (limited to 'camel/camel-charset-map.c')
-rw-r--r-- | camel/camel-charset-map.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c index 9bd4f4e253..dfa7b2402e 100644 --- a/camel/camel-charset-map.c +++ b/camel/camel-charset-map.c @@ -261,12 +261,19 @@ camel_charset_step (CamelCharset *c, const char *in, int len) static const char * camel_charset_best_mask(unsigned int mask) { + const char *locale_lang, *lang; int i; - - for (i=0;i<sizeof(camel_charinfo)/sizeof(camel_charinfo[0]);i++) { - if (camel_charinfo[i].bit & mask) - return camel_charinfo[i].name; + + locale_lang = e_iconv_locale_language (); + for (i = 0; i < G_N_ELEMENTS (camel_charinfo); i++) { + if (camel_charinfo[i].bit & mask) { + lang = e_iconv_charset_language (camel_charinfo[i].name); + + if (!lang || (locale_lang && !strncmp (locale_lang, lang, 2))) + return camel_charinfo[i].name; + } } + return "UTF-8"; } |