changeset 27853:ae2cc2905136

clean yahoo/util.c up.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 11 Jun 2008 11:05:22 +0000
parents f473058e3839
children fcd28c88459b
files libpurple/protocols/yahoo/util.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/util.c	Wed Jun 11 10:23:29 2008 +0000
+++ b/libpurple/protocols/yahoo/util.c	Wed Jun 11 11:05:22 2008 +0000
@@ -116,12 +116,13 @@
 	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);
+
 	if (ret)
 		return ret;
 	else
@@ -154,9 +155,9 @@
 	else
 		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);
+	ret = g_convert_with_fallback(str, -1, "UTF-8", from_codeset, NULL, NULL, NULL, NULL);
 
-	if (ret){
+	if (ret) {
 		tmp = ret;
 		ret = sanitize_utf((gchar *)tmp, strlen((gchar *)tmp), &newlen);
 		g_free(tmp);