From 672c0e3d47eadb2101b0bb30faaac831d2269e88 Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 6 Jun 2005 08:07:01 +0000 Subject: always enabled Japanese auto-detection if the locale is 'ja'. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@311 ee746299-78ed-0310-b773-934348b2243d --- src/codeconv.c | 22 ++++++++++++++++++++-- src/codeconv.h | 1 + 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/codeconv.c b/src/codeconv.c index 18fed44d..aff5711a 100644 --- a/src/codeconv.c +++ b/src/codeconv.c @@ -959,7 +959,7 @@ CodeConvFunc conv_get_code_conv_func(const gchar *src_encoding, /* auto detection mode */ if (!src_encoding && !dest_encoding) { - if (src_charset == C_EUC_JP || src_charset == C_SHIFT_JIS) + if (conv_is_ja_locale()) return conv_anytodisp; else return conv_noconv; @@ -1604,6 +1604,24 @@ const gchar *conv_get_current_locale(void) return cur_locale; } +gboolean conv_is_ja_locale(void) +{ + static gint is_ja_locale = -1; + const gchar *cur_locale; + + if (is_ja_locale != -1) + return is_ja_locale != 0; + + is_ja_locale = 0; + cur_locale = conv_get_current_locale(); + if (cur_locale) { + if (g_strncasecmp(cur_locale, "ja", 2) == 0) + is_ja_locale = 1; + } + + return is_ja_locale != 0; +} + gchar *conv_unmime_header(const gchar *str, const gchar *default_encoding) { gchar *buf; @@ -1622,7 +1640,7 @@ gchar *conv_unmime_header(const gchar *str, const gchar *default_encoding) } } - if (conv_get_locale_charset() == C_EUC_JP) + if (conv_is_ja_locale()) buf = conv_anytodisp(str, NULL); else buf = conv_localetodisp(str, NULL); diff --git a/src/codeconv.h b/src/codeconv.h index c17cd84c..833b1402 100644 --- a/src/codeconv.h +++ b/src/codeconv.h @@ -215,6 +215,7 @@ const gchar *conv_get_outgoing_charset_str (void); gboolean conv_is_multibyte_encoding (CharSet encoding); const gchar *conv_get_current_locale (void); +gboolean conv_is_ja_locale (void); gchar *conv_unmime_header (const gchar *str, const gchar *default_encoding); -- cgit v1.2.3