<<< Date Index >>>     <<< Thread Index >>>

Re: Traditional PGP and iconv (bug#1430)



Ultimately, this is a question how to best deal with a protocol that
lacks any kind of formalized character set tagging.  The idea behind
mutt's code is that UTF-8 is specified as the default encoding for
text data in RFC 2440 (the OpenPGP standard).

It's unfortunate that implementations don't seem to adhere to this
aspect of the standard.

(The correct way out of this problem is to use PGP-MIME for
encrypted messages that have non-ASCII content.)
-- 
Thomas Roessler · Personal soap box at <http://log.does-not-exist.org/>.





On 2003-08-10 19:08:33 +0200, Holger Weiss wrote:
> From: Holger Weiss <lists@xxxxxxxxxx>
> To: Mutt Devel <mutt-dev@xxxxxxxx>
> Date: Sun, 10 Aug 2003 19:08:33 +0200
> Subject: Traditional PGP and iconv (bug#1430)
> Mail-Followup-To: Mutt Devel <mutt-dev@xxxxxxxx>
> X-Spam-Level: 
> 
> I can reproduce the problem described in bug#1430 with 1.5.4 and with
> the current CVS version[*]. That is: Non-ascii chars like German umlauts
> are displayed as question marks when used in traditional PGP messages
> (created with clients such as MH, The Bat! or Pegasus Mail).
> 
> Mutt 1.5.x uses iconv when displaying traditional PGP content, and it
> expects the PGP output to be utf-8. If I hardcode "iso-8859-1" instead
> of "utf-8" (in 1.5.4), it works for me:
> 
> ----- 8< ----------------
> 
> --- pgp.c.orig  Tue Feb 25 22:28:54 2003
> +++ pgp.c       Sun Aug 10 18:51:40 2003
> @@ -368,7 +368,7 @@
>         int c;
>         rewind (pgpout);
>         state_set_prefix (s);
> -       fc = fgetconv_open (pgpout, "utf-8", Charset, 0);
> +       fc = fgetconv_open (pgpout, "iso-8859-1", Charset, 0);
>         while ((c = fgetconv (fc)) != EOF)
>           state_prefix_putc (c, s);
>         fgetconv_close (&fc);
> 
> ----- 8< ----------------
> 
> It also works if I simply use the old non-iconv code in 1.5.4:
> 
> ----- 8< ----------------
> 
> --- pgp.c.orig  Tue Feb 25 22:28:54 2003
> +++ pgp.c       Sun Aug 10 18:34:52 2003
> @@ -364,14 +364,14 @@
>        }
>        else if (pgpout)
>        {
> -       FGETCONV *fc;
> -       int c;
> +       fflush (pgpout);
>         rewind (pgpout);
> -       state_set_prefix (s);
> -       fc = fgetconv_open (pgpout, "utf-8", Charset, 0);
> -       while ((c = fgetconv (fc)) != EOF)
> -         state_prefix_putc (c, s);
> -       fgetconv_close (&fc);
> +       while (fgets (buf, sizeof (buf) - 1, pgpout) != NULL)
> +       {
> +         if (s->prefix)
> +           state_puts (s->prefix, s);
> +         state_puts (buf, s);
> +       }
>        }
> 
>        if (s->flags & M_DISPLAY)
> 
> ----- 8< ----------------
> 
> Since I try to avoid the topic "character sets" whenever I can, I don't
> know how one would want to solve this cleanly.
> 
> Holger
> 
> *) Tested on Linux, FreeBSD and Solaris with GnuPG 1.0.7 and 1.2.2.
> 
> -- 
> "After turning off the power to replace a part, turning the power on again
> is relatively simple."  -- SPARCstation 10 Service Manual
> ==========================================================================
>                              GnuPG: 0xB8B5D3DE | holger@xxxxxxxxxxxxxxxxxx
>