# HG changeset patch # User Daniel Atallah # Date 1222957187 0 # Node ID 9396a2124893044bec7ea0f80a52534aae129678 # Parent 3612a4fbd88ce73cf14c239c0ab38ff9fa9805e7 Add some debug output to the oscar encoding process. diff -r 3612a4fbd88c -r 9396a2124893 libpurple/protocols/oscar/oscar.c --- a/libpurple/protocols/oscar/oscar.c Thu Oct 02 06:53:24 2008 +0000 +++ b/libpurple/protocols/oscar/oscar.c Thu Oct 02 14:19:47 2008 +0000 @@ -508,7 +508,7 @@ b = purple_find_buddy(account, destsn); if ((b != NULL) && (PURPLE_BUDDY_IS_ONLINE(b))) { - *msg = g_convert(from, -1, "UTF-16BE", "UTF-8", NULL, &msglen, NULL); + *msg = g_convert(from, -1, "UTF-16BE", "UTF-8", NULL, &msglen, &err); if (*msg != NULL) { *charset = AIM_CHARSET_UNICODE; @@ -516,6 +516,11 @@ *msglen_int = msglen; return; } + + purple_debug_error("oscar", "Conversion from UTF-8 to UTF-16BE failed: %s.\n", + err->message); + g_error_free(err); + err = NULL; } } @@ -531,7 +536,7 @@ * XXX - We need a way to only attempt to convert if we KNOW "from" * can be converted to "charsetstr" */ - *msg = g_convert(from, -1, charsetstr, "UTF-8", NULL, &msglen, NULL); + *msg = g_convert(from, -1, charsetstr, "UTF-8", NULL, &msglen, &err); if (*msg != NULL) { *charset = AIM_CHARSET_CUSTOM; *charsubset = 0x0000; @@ -539,6 +544,11 @@ return; } + purple_debug_info("oscar", "Conversion from UTF-8 to %s failed (%s), falling back to unicode.\n", + charsetstr, err->message); + g_error_free(err); + err = NULL; + /* * Nothing else worked, so send as UTF-16BE. */ @@ -552,6 +562,7 @@ purple_debug_error("oscar", "Error converting a Unicode message: %s\n", err->message); g_error_free(err); + err = NULL; purple_debug_error("oscar", "This should NEVER happen! Sending UTF-8 text flagged as ASCII.\n"); *msg = g_strdup(from);