diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-04-17 03:01:46 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-04-17 03:01:46 +0800 |
commit | f9b7406f1dbc712cb1b4f40f0e729a25cf24f27c (patch) | |
tree | 15772c38a80556a6c4ff8ccaf35e5a53a6784118 /camel | |
parent | 862bee6f1256c143732f3447210c746fb7a6b1da (diff) | |
download | gsoc2013-evolution-f9b7406f1dbc712cb1b4f40f0e729a25cf24f27c.tar gsoc2013-evolution-f9b7406f1dbc712cb1b4f40f0e729a25cf24f27c.tar.gz gsoc2013-evolution-f9b7406f1dbc712cb1b4f40f0e729a25cf24f27c.tar.bz2 gsoc2013-evolution-f9b7406f1dbc712cb1b4f40f0e729a25cf24f27c.tar.lz gsoc2013-evolution-f9b7406f1dbc712cb1b4f40f0e729a25cf24f27c.tar.xz gsoc2013-evolution-f9b7406f1dbc712cb1b4f40f0e729a25cf24f27c.tar.zst gsoc2013-evolution-f9b7406f1dbc712cb1b4f40f0e729a25cf24f27c.zip |
Go back to doing the utf8 conversion by hand so that we don't depend on
2001-04-16 Jeffrey Stedfast <fejj@ximian.com>
* camel-pgp-context.c (pgp_verify): Go back to doing the utf8
conversion by hand so that we don't depend on gal.
svn path=/trunk/; revision=9387
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 3 | ||||
-rw-r--r-- | camel/camel-pgp-context.c | 47 |
2 files changed, 46 insertions, 4 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 803cd825da..d7ff60cc16 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,8 @@ 2001-04-16 Jeffrey Stedfast <fejj@ximian.com> + * camel-pgp-context.c (pgp_verify): Go back to doing the utf8 + conversion by hand so that we don't depend on gal. + * Makefile.am: Remove the EXTRA_GNOME_CFLAGS include. * camel-store.c (camel_mkdir_hier): Convenience function that it diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c index 0ac877c004..d6a725458a 100644 --- a/camel/camel-pgp-context.c +++ b/camel/camel-pgp-context.c @@ -29,9 +29,9 @@ #include "camel-stream-fs.h" #include "camel-stream-mem.h" -#include <gtk/gtk.h> /* for _() macro */ +#include "camel-charset-map.h" -#include <gal/widgets/e-unicode.h> +#include <gtk/gtk.h> /* for _() macro */ #include <stdio.h> #include <stdlib.h> @@ -52,6 +52,9 @@ #include <unistd.h> #include <signal.h> +#include <unicode.h> +#include <iconv.h> + #define d(x) struct _CamelPgpContextPrivate { @@ -963,9 +966,45 @@ pgp_verify (CamelCipherContext *ctx, CamelStream *istream, } if (diagnostics) { - char *desc; + char *locale, *desc, *outbuf; + size_t inlen, outlen; + iconv_t cd; + + inlen = strlen (diagnostics); + outlen = inlen * 4; + + desc = outbuf = g_new (unsigned char, outlen + 1); + + locale = camel_charset_locale_name (); + if (!locale) + locale = g_strdup ("iso-8859-1"); + + cd = iconv_open ("UTF-8", locale); + g_free (locale); + if (cd != (iconv_t) -1) { + const char *inbuf; + size_t len; + + inbuf = diagnostics; + len = iconv (cd, &inbuf, &inlen, &outbuf, &outlen); + iconv_close (cd); + + desc[len] = '\0'; + } else { + const char *inptr, *inend; + unicode_char_t c; + + inptr = diagnostics; + inend = inptr + inlen; + + while (inptr && inptr < inend) { + inptr = unicode_get_utf8 (inptr, &c); + *outbuf++ = c & 0xff; + } + + *outbuf = '\0'; + } - desc = e_utf8_from_locale_string (diagnostics); camel_cipher_validity_set_description (valid, desc); g_free (desc); } |