# HG changeset patch # User Ethan Blanton # Date 1166069822 0 # Node ID b8ae75fa8d6704c83a8755f8fc0a112354cd862f # Parent 83f0a2d3b44123fb3f036f8fb1a1089e7aeb5705 [gaim-migrate @ 17992] Attempt to salvage Oscar strings in an invalid encoding, as well as print an error message. committer: Tailor Script diff -r 83f0a2d3b441 -r b8ae75fa8d67 libgaim/protocols/oscar/oscar.c --- a/libgaim/protocols/oscar/oscar.c Thu Dec 14 01:47:25 2006 +0000 +++ b/libgaim/protocols/oscar/oscar.c Thu Dec 14 04:17:02 2006 +0000 @@ -426,8 +426,17 @@ ret = gaim_plugin_oscar_convert_to_utf8(data, datalen, charsetstr1, FALSE); if (ret == NULL) ret = gaim_plugin_oscar_convert_to_utf8(data, datalen, charsetstr2, TRUE); - if (ret == NULL) - ret = g_strdup(_("(There was an error receiving this message. Either you and the buddy you are speaking to have a different encoding selected, or the buddy has a buggy client.)")); + if (ret == NULL) { + char *str, *salvage; + + str = g_malloc(datalen + 1); + strncpy(str, datalen, data); + str[datalen] = '\0'; + salvage = gaim_utf8_salvage(str); + ret = g_strdup_printf(_("%s (There was an error receiving this message. Either you and the buddy you are speaking to have a different encoding selected, or the buddy has a buggy client.)"), salvage); + g_free(str); + g_free(salvage); + } return ret; }