diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-06-06 08:07:01 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-06-06 08:07:01 +0000 |
commit | 672c0e3d47eadb2101b0bb30faaac831d2269e88 (patch) | |
tree | 1c299fc3fb43670da1ea794a5f665d0ca2fe27f4 /src | |
parent | 5b6baa6b410e8012ad9ab1a1944dcf7164ea0b8f (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/codeconv.c | 22 | ||||
-rw-r--r-- | src/codeconv.h | 1 |
2 files changed, 21 insertions, 2 deletions
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); |