changeset 25095:15fc25014ce2

Convert from ISO-8859-1 to UTF-8 if no charset is supplied. This should fix messages from old clients. Fixes #8423.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 15 Feb 2009 23:08:38 +0000
parents 11458e8584c2
children 93463c6114aa
files libpurple/protocols/msn/msg.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c	Sun Feb 15 22:52:47 2009 +0000
+++ b/libpurple/protocols/msn/msg.c	Sun Feb 15 23:08:38 2009 +0000
@@ -352,6 +352,14 @@
 			memcpy(msg->body, tmp, msg->body_len);
 			msg->body[msg->body_len] = '\0';
 		}
+		
+		if (msg->charset == NULL) {
+			char *body = g_convert(msg->body, msg->body_len, "UTF-8",
+			                       "ISO-8859-1", NULL, &msg->body_len, NULL);
+			g_free(msg->body);
+			msg->body = body;
+			msg->charset = g_strdup("UTF-8");
+		}
 	}
 
 	g_free(tmp_base);