diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.ja | 7 | ||||
-rw-r--r-- | src/compose.c | 33 |
3 files changed, 35 insertions, 12 deletions
@@ -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, |