aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/codeconv.c22
-rw-r--r--src/codeconv.h1
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);