Mercurial > pidgin.yaz
changeset 9644:d54f14237255
[gaim-migrate @ 10492]
Converting from utf8 to utf8 on Solaris has problems. Arvind Samptur
pin-pointed the problem and provided a patch. If only car
mechanics were as efficient.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 02 Aug 2004 04:03:48 +0000 |
parents | b8aee06adc83 |
children | 1ba8c6a5ecd9 |
files | COPYRIGHT ChangeLog src/protocols/irc/parse.c |
diffstat | 3 files changed, 28 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Mon Aug 02 03:38:07 2004 +0000 +++ b/COPYRIGHT Mon Aug 02 04:03:48 2004 +0000 @@ -123,6 +123,7 @@ Tim Ringenbach Luciano Miguel Ferreira Rocha Andrew Rodland +Arvind Samptur Tom Samstag Neil Sanchala Carsten Schaar
--- a/ChangeLog Mon Aug 02 03:38:07 2004 +0000 +++ b/ChangeLog Mon Aug 02 04:03:48 2004 +0000 @@ -39,6 +39,8 @@ * The auto-reconnect plugin will no longer attempt to reconnect an MSN account if you were disconnected because you signed on from another location (Stu Tomlinson) + * On Solaris, chatting in IRC using the UTF-8 charset no longer gives + a "conversion failed" error for every message (Arvind Samptur) version 0.80 (07/15/2004): New Features:
--- a/src/protocols/irc/parse.c Mon Aug 02 03:38:07 2004 +0000 +++ b/src/protocols/irc/parse.c Mon Aug 02 04:03:48 2004 +0000 @@ -201,13 +201,16 @@ { char *utf8; GError *err = NULL; - - utf8 = g_convert(string, strlen(string), - gaim_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET), - "UTF-8", NULL, NULL, &err); + const gchar *charset; + + charset = gaim_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); + if (!strcasecmp("UTF-8", charset)) + return g_strdup(string); + + utf8 = g_convert(string, strlen(string), charset, "UTF-8", NULL, NULL, &err); if (err) { - gaim_debug(GAIM_DEBUG_ERROR, "irc", "send conversion error: %s\n", err->message); - gaim_debug(GAIM_DEBUG_ERROR, "irc", "Sending raw, which probably isn't right\n"); + gaim_debug(GAIM_DEBUG_ERROR, "irc", "Send conversion error: %s\n", err->message); + gaim_debug(GAIM_DEBUG_ERROR, "irc", "Sending as UTF-8 instead of %s\n", charset); utf8 = g_strdup(string); g_error_free(err); } @@ -217,18 +220,27 @@ static char *irc_recv_convert(struct irc_conn *irc, const char *string) { - char *utf8; + char *utf8 = NULL; GError *err = NULL; - - utf8 = g_convert(string, strlen(string), "UTF-8", - gaim_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET), - NULL, NULL, &err); + const gchar *charset; + + charset = gaim_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); + + if (!strcasecmp("UTF-8", charset)) { + if (g_utf8_validate(string, strlen(string), NULL)) + utf8 = g_strdup(string); + } else { + utf8 = g_convert(string, strlen(string), "UTF-8", charset, NULL, NULL, &err); + } + if (err) { gaim_debug(GAIM_DEBUG_ERROR, "irc", "recv conversion error: %s\n", err->message); - utf8 = g_strdup(_("(There was an error converting this message. Check the 'Encoding' option in the Account Editor)")); g_error_free(err); } - + + if (utf8 == NULL) + utf8 = g_strdup(_("(There was an error converting this message. Check the 'Encoding' option in the Account Editor)")); + return utf8; }