From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <87v9qtfame.fsf@tullinup.koldfront.dk> <87tv69pgtq.fsf@tullinup.koldfront.dk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="223838"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Lars Ingebrigtsen , 38512@debbugs.gnu.org To: Adam =?UTF-8?Q?Sj=C3=B8gren?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 11 14:27:16 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1if21L-000w6N-IA for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Dec 2019 14:27:16 +0100 Original-Received: from localhost ([::1]:42366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if21K-0000Ry-B6 for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Dec 2019 08:27:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54811) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1if20D-0007hJ-Ar for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2019 08:26:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1if20C-0003MP-3s for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2019 08:26:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51039) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1if20B-0003GV-Vr for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2019 08:26:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1if1Bq-0004M9-88; Wed, 11 Dec 2019 07:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Wed, 11 Dec 2019 12:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38512 X-GNU-PR-Package: emacs,gnus Original-Received: via spool by 38512-submit@debbugs.gnu.org id=B38512.157606760316699 (code B ref 38512); Wed, 11 Dec 2019 12:34:02 +0000 Original-Received: (at 38512) by debbugs.gnu.org; 11 Dec 2019 12:33:23 +0000 Original-Received: from localhost ([127.0.0.1]:56978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1if1BD-0004LH-9W for submit@debbugs.gnu.org; Wed, 11 Dec 2019 07:33:23 -0500 Original-Received: from mail-wm1-f42.google.com ([209.85.128.42]:36224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1if1BB-0004L5-V0 for 38512@debbugs.gnu.org; Wed, 11 Dec 2019 07:33:22 -0500 Original-Received: by mail-wm1-f42.google.com with SMTP id p17so6800017wma.1 for <38512@debbugs.gnu.org>; Wed, 11 Dec 2019 04:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version; bh=GQT4izBxE4j1XCCbm2jRXZnNgBNmSJCXaCy1rTEHmf4=; b=Cc99g09y1AKqcrEMv3k1wPqTpqBuBTnjJokvGt7Mnf0fs6hkjkzkTdtiuG8VylcPjl GdA3n8cmGAwpdE5jvdlasF7wlqZdHoKXcdBKMdo+cGIcskOqGkPv1wgSWX4UMdTZlPCv tWa2ZJNvHBBBEv+SAw3LesN8TPj4OQE3OAOeMxmmd+UIAaDov2IF9f71hECN3pJdzSOK PqZJBMtpPsbjBUycEnB74yW1q09jXtPFxuNDOLonyPVqEMjjGPgvzqCR8O+A3SYcMVxF h9FuJP47HGbLkk2rlY6mA0whb94iLboJO2g3QOibYPjv1eh+cW4sGa/aj4fqriQZat40 G39g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version; bh=GQT4izBxE4j1XCCbm2jRXZnNgBNmSJCXaCy1rTEHmf4=; b=BUG04g0zLdpKup0CCnryHU38+y0snIR4V8As62l5KxDe58/LpsHVWHTof/dTRKzr57 jLowuMXKodw8b/z6epJ3fG1I1B+7L3HQjs61qr+zJvymB+gMT/nF/YIGnSZZseLogIzA z3b32LoudsEFWwJy+x2iPJ+0EP8/43j8+Ju10oD7XXZOXprgzPDDhZgyxR4tWZSQl5w5 6zSiSKjhURpBdkBBKC0sO4/xL0I7U/3UdeZT99Nl6bca/YgaoE4mMF1q3MR7qsQLv5ST YRCkoycjCoJCdKx/nENhmYyV3wDHsKIXcs0nKUYNzyJrcM6jgx/Ed9k2fx5bHrHGu3sE 0qNw== X-Gm-Message-State: APjAAAWELmkyyYNEb00c31At7x+6XfZ+tCepijjbG8eXQc9WIm42NqaU zaEKupAsZl0lfUHhR6VmP0w= X-Google-Smtp-Source: APXvYqwTwem1ESyrwuURjUQAl7hcE0/IsvzzmHWJI9kXC5ynYUURcZcdumAu6+ulWpQJF6SxL06W9w== X-Received: by 2002:a05:600c:1051:: with SMTP id 17mr3356861wmx.49.1576067595771; Wed, 11 Dec 2019 04:33:15 -0800 (PST) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id p17sm2137578wrx.20.2019.12.11.04.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 04:33:14 -0800 (PST) In-Reply-To: <87tv69pgtq.fsf@tullinup.koldfront.dk> ("Adam =?UTF-8?Q?Sj=C3=B8gren?="'s message of "Mon, 09 Dec 2019 18:08:33 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:173176 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> On Mon, 09 Dec 2019 18:08:33 +0100, Adam Sj=C3=B8gren said: Adam> I can confirm that this patch fixes the problem I reported. Thanks for testing. Eli, is this OK for master? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Treat-passed-strings-as-raw-text-when-percent-escapi.patch >From 572f59f96c29f4ec5b8a584ba30348e475ee6598 Mon Sep 17 00:00:00 2001 From: Robert Pluim 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 --=-=-=--