Mercurial > pidgin.yaz
comparison libpurple/protocols/yahoo/util.c @ 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 | acef4202e147 |
children | f473058e3839 |
comparison
equal
deleted
inserted
replaced
27850:6e468ac26aac | 27851:389b22a4431c |
---|---|
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 (utf8 && *utf8) { | 119 if (yd->jp || (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); | |
125 | |
126 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); |
127 if (ret) | 125 if (ret) |
128 return ret; | 126 return ret; |
129 else | 127 else |
130 return g_strdup(""); | 128 return g_strdup(""); |
143 struct yahoo_data *yd = gc->proto_data; | 141 struct yahoo_data *yd = gc->proto_data; |
144 char *ret, *tmp; | 142 char *ret, *tmp; |
145 const char *from_codeset; | 143 const char *from_codeset; |
146 gsize newlen; | 144 gsize newlen; |
147 | 145 |
148 if (utf8) { | 146 if (yd->jp || utf8) { |
149 ret = sanitize_utf((gchar *)str, strlen((gchar *)str), &newlen); | 147 ret = sanitize_utf((gchar *)str, strlen((gchar *)str), &newlen); |
150 if (g_utf8_validate(ret, -1, NULL)) | 148 if (g_utf8_validate(ret, -1, NULL)) |
151 return ret; | 149 return ret; |
152 } | 150 } |
153 | 151 |
154 if (yd->jp && !utf8) | 152 from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); |
155 from_codeset = "SHIFT_JIS"; | |
156 else | |
157 from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); | |
158 | 153 |
159 ret = g_convert_with_fallback(str, strlen(str), "UTF-8", from_codeset, NULL, NULL, NULL, NULL); | 154 ret = g_convert_with_fallback(str, strlen(str), "UTF-8", from_codeset, NULL, NULL, NULL, NULL); |
160 | 155 |
161 if (ret){ | 156 if (ret){ |
162 tmp = ret; | 157 tmp = ret; |