aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-charset-map.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2004-07-29 00:44:08 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-07-29 00:44:08 +0800
commit6551a127b307eec1bf331a3cb31b8fdb0d4a0f92 (patch)
tree3b162a3d83db7456d709157aee3d454176eb7aa0 /camel/camel-charset-map.c
parent10bfd57c379db75b8def5b6bc1590f14484de03e (diff)
downloadgsoc2013-evolution-6551a127b307eec1bf331a3cb31b8fdb0d4a0f92.tar.gz
gsoc2013-evolution-6551a127b307eec1bf331a3cb31b8fdb0d4a0f92.tar.zst
gsoc2013-evolution-6551a127b307eec1bf331a3cb31b8fdb0d4a0f92.zip
Changed the logic slightly to only match certain charsets if the locale
2004-07-26 Jeffrey Stedfast <fejj@novell.com> * camel-charset-map.c (camel_charset_best_mask): Changed the logic slightly to only match certain charsets if the locale matches (Macedonians don't want to use koi8-r for example). svn path=/trunk/; revision=26758
Diffstat (limited to 'camel/camel-charset-map.c')
-rw-r--r--camel/camel-charset-map.c15
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";
}