changeset 21813:d62d7412eca4

Ensure that an error's description actually is UTF-8 before writing it out to accounts.xml. It might not be if a prpl uses strerror rather than g_strerror, for example. Fixes #4264.
author Will Thompson <will.thompson@collabora.co.uk>
date Mon, 10 Dec 2007 15:22:27 +0000
parents 937623b190a2
children d20a1c190c2f
files libpurple/account.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Mon Dec 10 13:10:58 2007 +0000
+++ b/libpurple/account.c	Mon Dec 10 15:22:27 2007 +0000
@@ -336,8 +336,13 @@
 	xmlnode_insert_data(child, type_str, -1);
 
 	child = xmlnode_new_child(node, "description");
-	if(err->description)
-		xmlnode_insert_data(child, err->description, -1);
+	if(err->description) {
+		char *utf8ized = purple_utf8_try_convert(err->description);
+		if(utf8ized == NULL)
+			utf8ized = purple_utf8_salvage(err->description);
+		xmlnode_insert_data(child, utf8ized, -1);
+		g_free(utf8ized);
+	}
 
 	return node;
 }