# HG changeset patch # User Yoshiki Yazawa # Date 1290089254 -32400 # Node ID ccd6a1da0d59c87b56cc9626ad30c0033691f082 # Parent 0462bec074142a8f20290202b20102843a9978d1 more unicode normalization diff -r 0462bec07414 -r ccd6a1da0d59 libpurple/protocols/oscar/encoding.c --- a/libpurple/protocols/oscar/encoding.c Wed Nov 10 11:41:51 2010 +0900 +++ b/libpurple/protocols/oscar/encoding.c Thu Nov 18 23:07:34 2010 +0900 @@ -109,13 +109,13 @@ oscar_utf8_try_convert(PurpleAccount *account, OscarData *od, const gchar *msg) { const char *charset = NULL; - char *ret = NULL; + char *ret = NULL, *ret2 = NULL; if (msg == NULL) return NULL; if (g_utf8_validate(msg, -1, NULL)) - return g_strdup(msg); + return sanitize_utf(msg, -1, NULL); if (od->icq) charset = purple_account_get_string(account, "encoding", NULL); @@ -126,7 +126,9 @@ if(!ret) ret = purple_utf8_try_convert(msg); - return ret; + ret2 = sanitize_utf(ret, -1, NULL); + g_free(ret); + return ret2; } static gchar * @@ -253,5 +255,13 @@ if (charsetstr != NULL) { *charsetstr = msg_charset == AIM_CHARSET_ASCII ? "us-ascii" : "unicode-2-0"; } - return g_convert(msg, -1, msg_charset == AIM_CHARSET_ASCII ? "ASCII" : "UTF-16BE", "UTF-8", NULL, result_len, NULL); + if (msg_charset == AIM_CHARSET_ASCII) { + return g_convert(msg, -1, "ASCII", "UTF-8", NULL, result_len, NULL); + } + else { + char *ucs = NULL; + ucs = g_convert(msg, -1, "UTF-16BE", "UTF-8", NULL, result_len, NULL); + botch_ucs(ucs, *result_len); + return ucs; + } }