From 42f57024627723df2a5221436022982d68662e20 Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 11 Jul 2005 09:44:55 +0000 Subject: compose.c: don't convert encoding if inserted file is UTF-8. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@418 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/compose.c b/src/compose.c index 0f5abb1a..767b17dd 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1696,9 +1696,14 @@ static gchar *compose_get_signature_str(Compose *compose) sig_str = sig_body; if (sig_str) { - utf8_sig_str = conv_codeset_strdup - (sig_str, conv_get_locale_charset_str(), CS_INTERNAL); - g_free(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); + g_free(sig_str); + } } return utf8_sig_str; @@ -1736,7 +1741,11 @@ static void compose_insert_file(Compose *compose, const gchar *file, while (fgets(buf, sizeof(buf), fp) != NULL) { gchar *str; - str = conv_codeset_strdup(buf, cur_encoding, CS_INTERNAL); + if (g_utf8_validate(buf, -1, NULL) == TRUE) + str = g_strdup(buf); + else + str = conv_codeset_strdup + (buf, cur_encoding, CS_INTERNAL); if (!str) continue; /* strip if DOS/Windows file, -- cgit v1.2.3