emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master d57bb0c: Treat passed strings as raw-text when percent-escapi


From: Robert Pluim
Subject: Re: master d57bb0c: Treat passed strings as raw-text when percent-escaping in epg
Date: Thu, 12 Dec 2019 17:11:07 +0100

>>>>> On Thu, 12 Dec 2019 16:42:04 +0100, Andreas Schwab <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]