diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-04-11 23:45:35 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-04-11 23:45:35 +0800 |
commit | 1a0534367e544cc35e3c171fbddc552bb2945a9c (patch) | |
tree | f1bbf5e2bea5fadfc9561942b0f00aee3bd3e8b8 /camel/camel-sasl-digest-md5.c | |
parent | 1ca457947eac5004f6af55d0d9a45cdc17790207 (diff) | |
download | gsoc2013-evolution-1a0534367e544cc35e3c171fbddc552bb2945a9c.tar gsoc2013-evolution-1a0534367e544cc35e3c171fbddc552bb2945a9c.tar.gz gsoc2013-evolution-1a0534367e544cc35e3c171fbddc552bb2945a9c.tar.bz2 gsoc2013-evolution-1a0534367e544cc35e3c171fbddc552bb2945a9c.tar.lz gsoc2013-evolution-1a0534367e544cc35e3c171fbddc552bb2945a9c.tar.xz gsoc2013-evolution-1a0534367e544cc35e3c171fbddc552bb2945a9c.tar.zst gsoc2013-evolution-1a0534367e544cc35e3c171fbddc552bb2945a9c.zip |
Use camel_charset_locale_name() to get the locale charset rather than
2001-04-11 Jeffrey Stedfast <fejj@ximian.com>
* camel-sasl-digest-md5.c (digest_response): Use
camel_charset_locale_name() to get the locale charset rather than
checking the CHARSET environment variable. This is a much less
ugly hack. Also: If we fail to be able to convert to UTF8, then
disavow all knowledge of the charset parameter.
* camel-charset-map.c (camel_charset_locale_name): New function to
return the locale charset (or NULL if US-ASCII).
svn path=/trunk/; revision=9237
Diffstat (limited to 'camel/camel-sasl-digest-md5.c')
-rw-r--r-- | camel/camel-sasl-digest-md5.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/camel/camel-sasl-digest-md5.c b/camel/camel-sasl-digest-md5.c index fa0d9a8175..0ef881ee41 100644 --- a/camel/camel-sasl-digest-md5.c +++ b/camel/camel-sasl-digest-md5.c @@ -286,7 +286,7 @@ decode_quoted_string (const char **in) } *outptr++ = c; } - *outptr = 0; + *outptr = '\0'; } *in = inptr; @@ -696,11 +696,12 @@ digest_response (struct _DigestResponse *resp) const char *buf; iconv_t cd; - charset = getenv ("CHARSET"); + charset = camel_charset_locale_name (); if (!charset) - charset = "ISO-8859-1"; + charset = g_strdup ("iso-8859-1"); cd = iconv_open (resp->charset, charset); + g_free (charset); len = strlen (resp->username); outlen = 2 * len; /* plenty of space */ @@ -708,6 +709,11 @@ digest_response (struct _DigestResponse *resp) outbuf = username = g_malloc0 (outlen + 1); buf = resp->username; if (cd == (iconv_t) -1 || iconv (cd, &buf, &len, &outbuf, &outlen) == -1) { + /* We can't convert to UTF-8 - pretend we never got a charset param? */ + g_free (resp->charset); + resp->charset = NULL; + + /* Set the username to the non-UTF-8 version */ g_free (username); username = g_strdup (resp->username); } @@ -716,6 +722,7 @@ digest_response (struct _DigestResponse *resp) iconv_close (cd); g_byte_array_append (buffer, username, strlen (username)); + g_free (username); } else { g_byte_array_append (buffer, resp->username, strlen (resp->username)); } |