changeset 27851:389b22a4431c

try to fix that the status message appears in wrong encoding when it comes back from auto-away status.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 11 Jun 2008 08:39:27 +0000
parents 6e468ac26aac
children f473058e3839
files libpurple/protocols/yahoo/util.c
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/util.c	Wed Jun 11 03:46:30 2008 +0000
+++ b/libpurple/protocols/yahoo/util.c	Wed Jun 11 08:39:27 2008 +0000
@@ -116,14 +116,12 @@
 	gsize newlen;
 	const char *to_codeset;
 
-	if (utf8 && *utf8) {
+	if (yd->jp || (utf8 && *utf8)) {
 		return botch_utf((gchar *)str, strlen((gchar *)str), &newlen);
 	}
 
 	to_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset",  "ISO-8859-1");
 	ret = g_convert_with_fallback(str, -1, to_codeset, "UTF-8", "?", NULL, NULL, NULL);
-
-	ret = g_convert_with_fallback(str, -1, to_codeset, "UTF-8", "?", NULL, NULL, NULL);
 	if (ret)
 		return ret;
 	else
@@ -145,16 +143,13 @@
 	const char *from_codeset;
 	gsize newlen;
 
-	if (utf8) {
+	if (yd->jp || utf8) {
 		ret = sanitize_utf((gchar *)str, strlen((gchar *)str), &newlen);
 		if (g_utf8_validate(ret, -1, NULL))
 			return ret;
 	}
 
-	if (yd->jp && !utf8)
-		from_codeset = "SHIFT_JIS";
-	else
-		from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset",  "ISO-8859-1");
+	from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset",  "ISO-8859-1");
 
 	ret = g_convert_with_fallback(str, strlen(str), "UTF-8", from_codeset, NULL, NULL, NULL, NULL);