bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii


From: Robert Pluim
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

>>>>> 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?

>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 via email to

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