[Commits] [SCM] claws branch, master, updated. 3.11.1-43-gff2f663

mones at claws-mail.org mones at claws-mail.org
Wed Dec 17 17:09:07 CET 2014


The branch, master has been updated
       via  ff2f663ebca80be4991c71be724d5a29ef5a3bdf (commit)
      from  656c1735cc75f73417ea1913355778bd4ecbc4fb (commit)

Summary of changes:
 src/codeconv.c |   11 ++++++++++-
 src/compose.c  |   11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit ff2f663ebca80be4991c71be724d5a29ef5a3bdf
Author: Ricardo Mones <ricardo at mones.org>
Date:   Wed Dec 17 16:45:12 2014 +0100

    Improve feedback to user when bug #3349

diff --git a/src/codeconv.c b/src/codeconv.c
index 98981e1..85dabf6 100644
--- a/src/codeconv.c
+++ b/src/codeconv.c
@@ -749,8 +749,17 @@ gchar *conv_codeset_strdup(const gchar *inbuf,
 	size_t len;
 	CodeConvFunc conv_func;
 
-	if (!strcmp2(src_code, dest_code))
+	if (!strcmp2(src_code, dest_code)) {
+		CharSet dest_charset = conv_get_charset_from_str(dest_code);
+		if (dest_charset == C_UTF_8) {
+			/* ensure valid UTF-8 if target is UTF-8 */
+			if (!g_utf8_validate(inbuf, -1, NULL)) {
+				return NULL;
+			}
+		}
+		/* otherwise, try for a lucky day */
 		return g_strdup(inbuf);
+	}
 
 	src_code = conv_get_fallback_for_private_encoding(src_code);
 	conv_func = conv_get_code_conv_func(src_code, dest_code);
diff --git a/src/compose.c b/src/compose.c
index 8f89975..03dbf48 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -3643,9 +3643,18 @@ static ComposeInsertResult compose_insert_file(Compose *compose, const gchar *fi
 
 		if (g_utf8_validate(buf, -1, NULL) == TRUE)
 			str = g_strdup(buf);
-		else
+		else {
 			str = conv_codeset_strdup
 				(buf, cur_encoding, CS_INTERNAL);
+			if (!str) {
+				alertpanel_error(_("Unable to insert the file "
+				"because converting to the internal encoding "
+				"failed. This may be caused by a binary file "
+				"or a wrongly encoded text file. If you are "
+				"sure this is the right file then try "
+				"attaching it instead."));
+			}
+		}
 		if (!str) continue;
 
 		/* strip <CR> if DOS/Windows file,

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list