diff libpurple/util.c @ 28101:c9c038529f38

Hmm, g_unichar_isgraph is too restrictive in the characters allowed (it munges \t). Change purple_utf8_strip_unprintables to simply remove ASCII control characters instead.
author Paul Aurich <paul@darkrain42.org>
date Thu, 27 Aug 2009 23:59:30 +0000
parents 703b20fa6c5c
children 6329667b9ea1
line wrap: on
line diff
--- a/libpurple/util.c	Wed Aug 26 05:56:20 2009 +0000
+++ b/libpurple/util.c	Thu Aug 27 23:59:30 2009 +0000
@@ -4660,17 +4660,11 @@
 	g_return_val_if_fail(g_utf8_validate(str, -1, NULL), NULL);
 
 	workstr = iter = g_new(gchar, strlen(str) + 1);
-	while (*str) {
-		gunichar c = g_utf8_get_char(str);
-		const gchar *next = g_utf8_next_char(str);
-		size_t len = next - str;
-
-		if (g_unichar_isprint(c)) {
-			memcpy(iter, str, len);
-			iter += len;
+	for ( ; *str; ++str) {
+		if (*str >= 0x20 || *str == 0x09 || *str == 0x0a || *str == 0x0d) {
+			*iter = *str;
+			++iter;
 		}
-
-		str = next;
 	}
 
 	/* nul-terminate the new string */