comparison libpurple/util.h @ 27101:bf9db4c67679

Add purple_utf8_strip_unprintables and use it on outgoing XMPP messages. We will no longer send messages which contain entities considered invalid in XML 1.0 (i.e.  and other ASCII control characters). Closes #5768.
author Paul Aurich <paul@darkrain42.org>
date Wed, 03 Jun 2009 19:09:16 +0000
parents af4a4ebc6441
children 6bd7b3e06233
comparison
equal deleted inserted replaced
27098:22bcf150f6c7 27101:bf9db4c67679
1246 * @return A valid UTF-8 string. 1246 * @return A valid UTF-8 string.
1247 */ 1247 */
1248 gchar *purple_utf8_salvage(const char *str); 1248 gchar *purple_utf8_salvage(const char *str);
1249 1249
1250 /** 1250 /**
1251 * Removes unprintable characters from a UTF-8 string. These characters
1252 * (in particular low-ASCII characters) are invalid in XML 1.0 and thus
1253 * are not allowed in XMPP and are rejected by libxml2 by default. This
1254 * function uses g_unichar_isprint to determine what characters should
1255 * be stripped. The returned string must be freed by the caller.
1256 *
1257 * @param str A valid UTF-8 string.
1258 *
1259 * @return A newly allocated UTF-8 string without the unprintable characters.
1260 *
1261 * @see g_unichar_isprint
1262 */
1263 gchar *purple_utf8_strip_unprintables(const gchar *str);
1264
1265 /**
1251 * Return the UTF-8 version of gai_strerror(). It calls gai_strerror() 1266 * Return the UTF-8 version of gai_strerror(). It calls gai_strerror()
1252 * then converts the result to UTF-8. This function is analogous to 1267 * then converts the result to UTF-8. This function is analogous to
1253 * g_strerror(). 1268 * g_strerror().
1254 * 1269 *
1255 * @param errnum The error code. 1270 * @param errnum The error code.