pidgin: 4021ee6b: Convert from ISO-8859-1 to UTF-8 if no c...

qulogic at pidgin.im qulogic at pidgin.im
Sun Feb 15 18:15:50 EST 2009


-----------------------------------------------------------------
Revision: 4021ee6bbfa81bd2fda8e2760cb4ae05d5c30083
Ancestor: 32b49e8309b1bb3241307b1981798feebf48fdf8
Author: qulogic at pidgin.im
Date: 2009-02-15T23:08:38
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4021ee6bbfa81bd2fda8e2760cb4ae05d5c30083

Modified files:
        libpurple/protocols/msn/msg.c

ChangeLog: 

Convert from ISO-8859-1 to UTF-8 if no charset is supplied. This should fix
messages from old clients.

Fixes #8423.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msg.c	9f8382b8b397eef9a466728a27a658f9aeef9c8f
+++ libpurple/protocols/msn/msg.c	e635599d8868e7b8a31662d4605556c25fb19839
@@ -352,6 +352,14 @@ msn_message_parse_payload(MsnMessage *ms
 			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);


More information about the Commits mailing list