# HG changeset patch # User Paul Aurich # Date 1251417646 0 # Node ID 4bbf2488993456344c0ea08bf587d91c6760f183 # Parent 268b821de5c57450649efafca63bb981105091f7# Parent c9c038529f384b071385a793a392a9330067e6cb merge of '4b37450c5470f1f61cdba5cf5de7a6abb166b2c1' and 'c61d5559bb5cfd55defb3613015e9118dbc2184e' diff -r 268b821de5c5 -r 4bbf24889934 libpurple/util.c --- a/libpurple/util.c Thu Aug 27 05:58:57 2009 +0000 +++ b/libpurple/util.c Fri Aug 28 00:00:46 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 */ diff -r 268b821de5c5 -r 4bbf24889934 libpurple/util.h --- a/libpurple/util.h Thu Aug 27 05:58:57 2009 +0000 +++ b/libpurple/util.h Fri Aug 28 00:00:46 2009 +0000 @@ -1286,16 +1286,14 @@ /** * Removes unprintable characters from a UTF-8 string. These characters * (in particular low-ASCII characters) are invalid in XML 1.0 and thus - * are not allowed in XMPP and are rejected by libxml2 by default. This - * function uses g_unichar_isprint to determine what characters should - * be stripped. The returned string must be freed by the caller. + * are not allowed in XMPP and are rejected by libxml2 by default. + * + * The returned string must be freed by the caller. * * @param str A valid UTF-8 string. * * @return A newly allocated UTF-8 string without the unprintable characters. * @since 2.6.0 - * - * @see g_unichar_isprint */ gchar *purple_utf8_strip_unprintables(const gchar *str);