Mercurial > pidgin.yaz
comparison libpurple/protocols/yahoo/util.c @ 27852:f473058e3839
yahoo status fix second try.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 11 Jun 2008 10:23:29 +0000 |
parents | 389b22a4431c |
children | ae2cc2905136 |
comparison
equal
deleted
inserted
replaced
27851:389b22a4431c | 27852:f473058e3839 |
---|---|
114 struct yahoo_data *yd = gc->proto_data; | 114 struct yahoo_data *yd = gc->proto_data; |
115 char *ret = NULL; | 115 char *ret = NULL; |
116 gsize newlen; | 116 gsize newlen; |
117 const char *to_codeset; | 117 const char *to_codeset; |
118 | 118 |
119 if (yd->jp || (utf8 && *utf8)) { | 119 if (utf8 && *utf8) { |
120 return botch_utf((gchar *)str, strlen((gchar *)str), &newlen); | 120 return botch_utf((gchar *)str, strlen((gchar *)str), &newlen); |
121 } | 121 } |
122 | 122 |
123 to_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); | 123 to_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); |
124 ret = g_convert_with_fallback(str, -1, to_codeset, "UTF-8", "?", NULL, NULL, NULL); | 124 ret = g_convert_with_fallback(str, -1, to_codeset, "UTF-8", "?", NULL, NULL, NULL); |
141 struct yahoo_data *yd = gc->proto_data; | 141 struct yahoo_data *yd = gc->proto_data; |
142 char *ret, *tmp; | 142 char *ret, *tmp; |
143 const char *from_codeset; | 143 const char *from_codeset; |
144 gsize newlen; | 144 gsize newlen; |
145 | 145 |
146 if (yd->jp || utf8) { | 146 if (utf8) { |
147 ret = sanitize_utf((gchar *)str, strlen((gchar *)str), &newlen); | 147 ret = sanitize_utf((gchar *)str, strlen((gchar *)str), &newlen); |
148 if (g_utf8_validate(ret, -1, NULL)) | 148 if (g_utf8_validate(ret, -1, NULL)) |
149 return ret; | 149 return ret; |
150 } | 150 } |
151 | 151 |
152 from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); | 152 if (yd->jp && !utf8) |
153 from_codeset = "SHIFT_JIS"; | |
154 else | |
155 from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); | |
153 | 156 |
154 ret = g_convert_with_fallback(str, strlen(str), "UTF-8", from_codeset, NULL, NULL, NULL, NULL); | 157 ret = g_convert_with_fallback(str, strlen(str), "UTF-8", from_codeset, NULL, NULL, NULL, NULL); |
155 | 158 |
156 if (ret){ | 159 if (ret){ |
157 tmp = ret; | 160 tmp = ret; |