summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Komarov <ivan.komarov@pidgin.im>2010-12-16 21:18:02 +0000
committerIvan Komarov <ivan.komarov@pidgin.im>2010-12-16 21:18:02 +0000
commitd4a57961156e0569129bee317d460233439f9165 (patch)
tree6b2a16b6146bda6c9f33471b0321fc9c4e6bc216
parent5c6aa708bfac90a2695c30ea9bf255ad7a18dc27 (diff)
downloadpidgin-d4a57961156e0569129bee317d460233439f9165.tar.gz
Restore the previous behavior (kind of) of falling back to the specified
Account-specific encoding when we receive a message without the encoding specified (such as the ones that Miranda sends when "Send Unicode messages" is disabled). Fixes #12778 committer: Daniel Atallah <datallah@pidgin.im>
-rw-r--r--libpurple/protocols/oscar/oscar.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c
index 8dcf8c844d..3fdd6a1984 100644
--- a/libpurple/protocols/oscar/oscar.c
+++ b/libpurple/protocols/oscar/oscar.c
@@ -1799,9 +1799,23 @@ incomingim_chan2(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo,
if (args->info.rtfmsg.msgtype == 1) {
if (args->info.rtfmsg.msg != NULL) {
- char *rtfmsg = oscar_encoding_to_utf8(args->encoding, args->info.rtfmsg.msg, strlen(args->info.rtfmsg.msg));
+ char *rtfmsg;
+ const char *encoding = args->encoding;
+ size_t len = strlen(args->info.rtfmsg.msg);
char *tmp, *tmp2;
+ if (encoding == NULL && !g_utf8_validate(args->info.rtfmsg.msg, len, NULL)) {
+ /* Yet another wonderful Miranda-related hack. If their user disables the "Send Unicode messages" setting,
+ * Miranda sends us ch2 messages in whatever Windows codepage is set as default on their user's system (instead of UTF-8).
+ * Of course, they don't bother to specify that codepage. Let's just fallback to the encoding OUR users can
+ * specify in account options as a last resort.
+ */
+ encoding = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
+ purple_debug_info("oscar", "Miranda, is that you? Using '%s' as encoding\n", encoding);
+ }
+
+ rtfmsg = oscar_encoding_to_utf8(encoding, args->info.rtfmsg.msg, len);
+
/* Channel 2 messages are supposed to be plain-text (never mind the name "rtfmsg", even
* the official client doesn't parse them as RTF). Therefore, we should escape them before
* showing to the user. */