diff options
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-iconv.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/e-util/e-iconv.c b/e-util/e-iconv.c index d241e1bf7d..0997878e81 100644 --- a/e-util/e-iconv.c +++ b/e-util/e-iconv.c @@ -187,6 +187,23 @@ static EDListNode *e_dlist_remove(EDListNode *n) return n; } +/* + we don't want to lower charset names in native locale (look what does in such case ISO-8859-9), + but rather lower them in "pure" C locale + this fixes bug #24179 +*/ +static void +C_g_strdown (gchar *string) +{ + gchar *old_locale; + + old_locale = g_strdup (setlocale (LC_CTYPE, NULL)); + setlocale (LC_CTYPE, "C"); + g_strdown (string); + setlocale (LC_CTYPE, old_locale); + g_free (old_locale); +} + /* NOTE: Owns the lock on return if keep is TRUE ! */ static void e_iconv_init(int keep) @@ -207,7 +224,7 @@ e_iconv_init(int keep) for (i = 0; known_iconv_charsets[i].charset != NULL; i++) { from = g_strdup(known_iconv_charsets[i].charset); to = g_strdup(known_iconv_charsets[i].iconv_name); - g_strdown(from); + C_g_strdown(from); g_hash_table_insert(iconv_charsets, from, to); } @@ -227,7 +244,7 @@ e_iconv_init(int keep) } else { #ifdef HAVE_CODESET locale_charset = g_strdup(nl_langinfo(CODESET)); - g_strdown(locale_charset); + C_g_strdown(locale_charset); #else /* A locale name is typically of the form language[_terri- * tory][.codeset][@modifier], where language is an ISO 639 @@ -244,7 +261,7 @@ e_iconv_init(int keep) /* ; is a hack for debian systems and / is a hack for Solaris systems */ for (p = codeset; *p && !strchr ("@;/", *p); p++); locale_charset = g_strndup (codeset, p - codeset); - g_strdown (locale_charset); + C_g_strdown (locale_charset); } else { /* charset unknown */ locale_charset = NULL; @@ -265,7 +282,7 @@ const char *e_iconv_charset_name(const char *charset) name = alloca(strlen(charset)+1); strcpy(name, charset); - g_strdown(name); + C_g_strdown(name); e_iconv_init(TRUE); ret = g_hash_table_lookup(iconv_charsets, name); |