aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-02-08 04:32:05 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-02-08 04:32:05 +0000
commit224290463c8e1dca64c82272d5a382930c483145 (patch)
treefc3b775d2fea859c09a99d7b8884b41adc645ce7
parent71a50733bb4cd3654b81efd8c349d7a79ef7524a (diff)
fixed locale encoding problem on win32.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@987 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.ja9
-rw-r--r--libsylph/codeconv.c20
-rw-r--r--src/rfc2015.c5
4 files changed, 40 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0983c289..c59869db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-02-08
+
+ * libsylph/codeconv.c:
+ conv_get_locale_charset()
+ conv_get_locale_charset_str(): use GLib API on Win32 (fixes wrong
+ encoding returned).
+ src/rfc2015.c: sig_status_full(): use g_locale_to_utf8() for locale
+ to UTF-8 conversion.
+
2006-02-07
* src/mainwindow.c: made the help window of command line options
diff --git a/ChangeLog.ja b/ChangeLog.ja
index c33a93c7..461dfe88 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,12 @@
+2006-02-08
+
+ * libsylph/codeconv.c:
+ conv_get_locale_charset()
+ conv_get_locale_charset_str(): Win32 では GLib API を使用するように
+ した(誤ったエンコーディングが返るのを修正)。
+ src/rfc2015.c: sig_status_full(): ロケールから UTF-8 への変換に
+ g_locale_to_utf8() を使用。
+
2006-02-07
* src/mainwindow.c: コマンドラインオプションのヘルプウィンドウを
diff --git a/libsylph/codeconv.c b/libsylph/codeconv.c
index 73bebb7f..59b5bd71 100644
--- a/libsylph/codeconv.c
+++ b/libsylph/codeconv.c
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1841,7 +1841,9 @@ CharSet conv_get_locale_charset(void)
static CharSet cur_charset = -1;
const gchar *cur_locale;
const gchar *p;
+#ifndef G_OS_WIN32
gint i;
+#endif
if (cur_charset != -1)
return cur_charset;
@@ -1862,6 +1864,11 @@ CharSet conv_get_locale_charset(void)
return cur_charset;
}
+#ifdef G_OS_WIN32
+ cur_charset = conv_get_charset_from_str(conv_get_locale_charset_str());
+
+ return cur_charset;
+#else
for (i = 0; i < sizeof(locale_table) / sizeof(locale_table[0]); i++) {
const gchar *p;
@@ -1884,14 +1891,23 @@ CharSet conv_get_locale_charset(void)
cur_charset = C_AUTO;
return cur_charset;
+#endif
}
const gchar *conv_get_locale_charset_str(void)
{
static const gchar *codeset = NULL;
- if (!codeset)
+ if (!codeset) {
+#ifdef G_OS_WIN32
+ g_get_charset(&codeset);
+ if (!strcmp(codeset, CS_US_ASCII) ||
+ !strcmp(codeset, CS_ANSI_X3_4_1968))
+ codeset = CS_INTERNAL;
+#else
codeset = conv_get_charset_str(conv_get_locale_charset());
+#endif
+ }
return codeset ? codeset : CS_INTERNAL;
}
diff --git a/src/rfc2015.c b/src/rfc2015.c
index fc2ccfb7..8f1d975f 100644
--- a/src/rfc2015.c
+++ b/src/rfc2015.c
@@ -172,7 +172,10 @@ static gchar *sig_status_full(gpgme_ctx_t ctx, gpgme_verify_result_t result)
ctime_val = localtime(&created);
my_strftime(ctime_str, sizeof (ctime_str), "%c",
ctime_val);
- ctime_str_utf8 = conv_localetodisp(ctime_str, NULL);
+ ctime_str_utf8 = g_locale_to_utf8(ctime_str, -1,
+ NULL, NULL, NULL);
+ if (!ctime_str_utf8)
+ ctime_str_utf8 = g_strdup(ctime_str);
g_string_sprintfa(str, _("Signature made at %s\n"),
ctime_str_utf8);
g_free(ctime_str_utf8);