unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: "Adam Sjøgren" <asjo@koldfront.dk>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 38512@debbugs.gnu.org
Subject: bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error
Date: Wed, 11 Dec 2019 13:33:13 +0100	[thread overview]
Message-ID: <m236dryrcm.fsf@gmail.com> (raw)
In-Reply-To: <87tv69pgtq.fsf@tullinup.koldfront.dk> ("Adam Sjøgren"'s message of "Mon, 09 Dec 2019 18:08:33 +0100")

[-- Attachment #1: Type: text/plain, Size: 209 bytes --]

>>>>> On Mon, 09 Dec 2019 18:08:33 +0100, Adam Sjøgren <asjo@koldfront.dk> said:

    Adam> I can confirm that this patch fixes the problem I reported.

Thanks for testing. Eli, is this OK for master?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Treat-passed-strings-as-raw-text-when-percent-escapi.patch --]
[-- Type: text/x-patch, Size: 1185 bytes --]

From 572f59f96c29f4ec5b8a584ba30348e475ee6598 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
Date: Mon, 9 Dec 2019 18:41:59 +0100
Subject: [PATCH] Treat passed strings as raw-text when percent-escaping in epg
To: emacs-devel@gnu.org

The strings contained in gpg keys can contain UTF-8 data, but can also
use percent-escapes to encode non-ASCII chars.  When converting those
escapes, use 'raw-text' coding system rather than 'string-to-unibyte',
since the latter signals an error for non-ASCII characters.

* lisp/epg.el (epg--decode-percent-escape): Convert the passed
string to raw-text before treating percent escapes (Bug#38512).
---
 lisp/epg.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/epg.el b/lisp/epg.el
index 090317f422..5466716e34 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -2032,7 +2032,7 @@ epg-edit-key
     (epg-reset context)))
 
 (defun epg--decode-percent-escape (string)
-  (setq string (string-to-unibyte string))
+  (setq string (encode-coding-string string 'raw-text))
   (let ((index 0))
     (while (string-match "%\\(\\(%\\)\\|\\([[:xdigit:]][[:xdigit:]]\\)\\)"
 			 string index)
-- 
2.24.0.155.gd9f6f3b619


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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 20:43 bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error Unknown
2019-12-09 16:26 ` Robert Pluim
2019-12-09 17:08   ` Unknown
2019-12-11 12:33     ` Robert Pluim [this message]
2019-12-11 16:33       ` Eli Zaretskii
2019-12-12  7:37         ` 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=m236dryrcm.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=38512@debbugs.gnu.org \
    --cc=asjo@koldfront.dk \
    --cc=larsi@gnus.org \
    /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).