pidgin: f2efeafe: Add more verbose debugging to purple_utf...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Fri Aug 28 01:30:43 EDT 2009


-----------------------------------------------------------------
Revision: f2efeafeada79c882e6f98bd0b18d6cec9bd0f09
Ancestor: ff0d329416c040b67dd99f6bd503bce18bda83e3
Author: darkrain42 at pidgin.im
Date: 2009-08-28T05:27:00
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f2efeafeada79c882e6f98bd0b18d6cec9bd0f09

Modified files:
        libpurple/util.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/util.c	a8baa6de313143bd81f67a3b37b904f8c2e4397a
+++ libpurple/util.c	90c74eb15d980752568a6341719bd09ff171af68
@@ -4652,12 +4652,18 @@ purple_utf8_strip_unprintables(const gch
 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) {


More information about the Commits mailing list