aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-11-21 09:39:07 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-11-21 09:39:07 +0000
commit8c010a245f24fb83baf02ed397b2ea742eaae21c (patch)
tree9d0fcc200a11acde74b304ba5d28d3ff2cc7a3fd
parenta7ff06e76f292fe17935eb1b2f09e145e054da76 (diff)
compose.c: give priority to locale to UTF-8 conversion.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@767 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.ja7
-rw-r--r--src/compose.c33
3 files changed, 35 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index c4fe11f3..758a628e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2005-11-21
+ * src/compose.c:
+ compose_get_signature_str()
+ compose_insert_file(): give priority to locale to UTF-8 conversion
+ (fixes wrong Japanese conversion on some case).
+
+2005-11-21
+
* libsylph/prefs_common.[ch]: modified the order of options.
2005-11-21
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 54d38b2d..bfdc7ff5 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,12 @@
2005-11-21
+ * src/compose.c:
+ compose_get_signature_str()
+ compose_insert_file(): ロケール→UTF-8 変換を優先するようにした
+ (日本語の変換を一部誤るのを修正)。
+
+2005-11-21
+
* libsylph/prefs_common.[ch]: オプションの順序を変更。
2005-11-21
diff --git a/src/compose.c b/src/compose.c
index 36898417..5983fc14 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1775,14 +1775,19 @@ static gchar *compose_get_signature_str(Compose *compose)
sig_str = sig_body;
if (sig_str) {
- if (g_utf8_validate(sig_str, -1, NULL) == TRUE)
- utf8_sig_str = sig_str;
- else {
- utf8_sig_str = conv_codeset_strdup
- (sig_str, conv_get_locale_charset_str(),
- CS_INTERNAL);
+ gint error = 0;
+
+ utf8_sig_str = conv_codeset_strdup_full
+ (sig_str, conv_get_locale_charset_str(),
+ CS_INTERNAL, &error);
+ if (!utf8_sig_str || error != 0) {
+ if (g_utf8_validate(sig_str, -1, NULL) == TRUE) {
+ g_free(utf8_sig_str);
+ utf8_sig_str = sig_str;
+ } else
+ g_free(sig_str);
+ } else
g_free(sig_str);
- }
}
return utf8_sig_str;
@@ -1819,12 +1824,16 @@ static void compose_insert_file(Compose *compose, const gchar *file,
while (fgets(buf, sizeof(buf), fp) != NULL) {
gchar *str;
+ gint error = 0;
- if (g_utf8_validate(buf, -1, NULL) == TRUE)
- str = g_strdup(buf);
- else
- str = conv_codeset_strdup
- (buf, cur_encoding, CS_INTERNAL);
+ str = conv_codeset_strdup_full(buf, cur_encoding, CS_INTERNAL,
+ &error);
+ if (!str || error != 0) {
+ if (g_utf8_validate(buf, -1, NULL) == TRUE) {
+ g_free(str);
+ str = g_strdup(buf);
+ }
+ }
if (!str) continue;
/* strip <CR> if DOS/Windows file,