changeset 28459:0a4d0d4cf5df

Add more verbose debugging to purple_utf8_strip_unprintables. I have no idea how something is getting into this (on XMPP) that is invalid UTF-8 when it's fine as it's printed out in the sending-im-msg signal.
author Paul Aurich <paul@darkrain42.org>
date Fri, 28 Aug 2009 05:27:00 +0000
parents 6329667b9ea1
children 6b018d1efc5c
files libpurple/util.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Fri Aug 28 01:04:51 2009 +0000
+++ b/libpurple/util.c	Fri Aug 28 05:27:00 2009 +0000
@@ -4652,12 +4652,18 @@
 purple_utf8_strip_unprintables(const gchar *str)
 {
 	gchar *workstr, *iter;
+	const gchar *bad;
 
 	if (str == NULL)
 		/* Act like g_strdup */
 		return NULL;
 
-	g_return_val_if_fail(g_utf8_validate(str, -1, NULL), NULL);
+	if (g_utf8_validate(str, -1, &bad)) {
+		purple_debug_error("util", "purple_utf8_strip_unprintables(%s) failed; "
+		                           "first bad character was %02x (%c)\n",
+		                   str, *bad, *bad);
+		g_return_val_if_reached(NULL);
+	}
 
 	workstr = iter = g_new(gchar, strlen(str) + 1);
 	for ( ; *str; ++str) {