diff options
Diffstat (limited to 'libpurple/protocols/oscar/oscar.c')
-rw-r--r-- | libpurple/protocols/oscar/oscar.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c index afd55be613..8e6ef7a2ed 100644 --- a/libpurple/protocols/oscar/oscar.c +++ b/libpurple/protocols/oscar/oscar.c @@ -508,7 +508,7 @@ purple_plugin_oscar_convert_to_best_encoding(PurpleConnection *gc, 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 @@ purple_plugin_oscar_convert_to_best_encoding(PurpleConnection *gc, *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 @@ purple_plugin_oscar_convert_to_best_encoding(PurpleConnection *gc, * 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 @@ purple_plugin_oscar_convert_to_best_encoding(PurpleConnection *gc, 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_plugin_oscar_convert_to_best_encoding(PurpleConnection *gc, 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); |