unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: master d57bb0c: Treat passed strings as raw-text when percent-escaping in epg
Date: Thu, 12 Dec 2019 17:11:07 +0100	[thread overview]
Message-ID: <m2blsdwmlg.fsf@gmail.com> (raw)
In-Reply-To: <mvm1rt9ft4j.fsf@suse.de> (Andreas Schwab's message of "Thu, 12 Dec 2019 16:42:04 +0100")

>>>>> On Thu, 12 Dec 2019 16:42:04 +0100, Andreas Schwab <schwab@suse.de> said:

    Andreas> On Dez 12 2019, Robert Pluim wrote:
    >> "can contain non-ASCII characters encoded using UTF-8", which means
    >> they end up in a multi-byte string in emacs.

    Andreas> Only encoded data can contain UTF-8 encoded characters.  A decoded
    Andreas> string just contains (Unicode) characters.

The data inside the gpg key is encoded, and is decoded by emacs into a
multi-byte string.

    >> No. The string that is passed to epg--decode-percent-escape can
    >> contain non-ASCII characters encoded as UTF-8,

    Andreas> If the argument of epg--decode-percent-escape is a multi-byte string,
    Andreas> then it isn't encoded.

Yes, my terminology is confused.

    >> In order to convert those percent-escaped characters correctly, the
    >> string has to be treated as a unibyte array of bytes

    Andreas> Why?

It starts as a multibyte string containing non-ascii chars, plus a
representation of non-ascii chars using percent escapes, eg

"ü%C3%A9"

epg--decode-percent-escape replace the escapes with the corresponding
characters, so now we have

"üé"

when what we really want is

"üé"

If we convert the initial string to 'bunch of bytes' before escaping,
then convert back to multibyte after, we get the correct
answer.

Robert



  reply	other threads:[~2019-12-12 16:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191212073737.19923.49084@vcs0.savannah.gnu.org>
     [not found] ` <20191212073738.9C7A3200E3@vcs0.savannah.gnu.org>
2019-12-12 13:58   ` master d57bb0c: Treat passed strings as raw-text when percent-escaping in epg Stefan Monnier
2019-12-12 15:19     ` Robert Pluim
2019-12-12 15:28       ` Eli Zaretskii
2019-12-12 15:33         ` Robert Pluim
2019-12-12 15:36           ` Eli Zaretskii
2019-12-12 15:30       ` Robert Pluim
2019-12-12 15:45         ` Eli Zaretskii
2019-12-12 16:17           ` Robert Pluim
2019-12-16 16:06           ` Stefan Monnier
2019-12-12 15:42       ` Andreas Schwab
2019-12-12 16:11         ` Robert Pluim [this message]
2019-12-12 16:33           ` Andreas Schwab
2019-12-12 16:39             ` Robert Pluim
2019-12-12 16:55               ` Andreas Schwab
2019-12-12 17:57           ` Eli Zaretskii
2019-12-13  9:40             ` Robert Pluim
2019-12-13 10:33               ` Eli Zaretskii
2019-12-16 16:21       ` Stefan Monnier
2019-12-16 16:38         ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2blsdwmlg.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).