diff src/protocols/yahoo/util.c @ 9164:76125b842b23

[gaim-migrate @ 9949] This is proper yahoo japan support. Technically it worked before, but you had to know the yahoo japan server, and typing in nonascii didn't work. The account options are kind of ugly. Eventually Chip is going to replace the check box with something more like a dropdown thingy, that automaticly hides the settings that aren't used (Pager Host vs. Japan Pager Host, etc) But it's not too bad now. And I think I orignally wrote this patch for 0.64 or something, so I got tired of waiting. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Wed, 02 Jun 2004 03:02:50 +0000
parents eb3c59b0a16c
children 34bce9529cf4
line wrap: on
line diff
--- a/src/protocols/yahoo/util.c	Wed Jun 02 01:26:21 2004 +0000
+++ b/src/protocols/yahoo/util.c	Wed Jun 02 03:02:50 2004 +0000
@@ -44,13 +44,20 @@
  */
 char *yahoo_string_encode(GaimConnection *gc, const char *str, gboolean *utf8)
 {
+	struct yahoo_data *yd = gc->proto_data;
 	char *ret;
 	char *to_codeset;
 
+	if (yd->jp && utf8 && *utf8)
+		*utf8 = FALSE;
+
 	if (utf8 && *utf8) /* FIXME: maybe don't use utf8 if it'll fit in latin1 */
 		return g_strdup(str);
 
-	to_codeset = "ISO-8859-1";
+	if (yd->jp)
+		to_codeset = "SHIFT_JIS";
+	else
+		to_codeset = "ISO-8859-1";
 
 	ret = g_convert_with_fallback(str, strlen(str), to_codeset, "UTF-8", "?", NULL, NULL, NULL);
 	if (ret)
@@ -69,6 +76,7 @@
  */
 char *yahoo_string_decode(GaimConnection *gc, const char *str, gboolean utf8)
 {
+	struct yahoo_data *yd = gc->proto_data;
 	char *ret;
 	char *from_codeset;
 
@@ -77,7 +85,10 @@
 			return g_strdup(str);
 	}
 
-	from_codeset = "ISO-8859-1";
+	if (yd->jp)
+		from_codeset = "SHIFT_JIS";
+	else
+		from_codeset = "ISO-8859-1";
 
 	ret = g_convert_with_fallback(str, strlen(str), "UTF-8", from_codeset, NULL, NULL, NULL, NULL);