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.devel Subject: Re: master d57bb0c: Treat passed strings as raw-text when percent-escaping in epg Date: Thu, 12 Dec 2019 17:11:07 +0100 Message-ID: References: <20191212073737.19923.49084@vcs0.savannah.gnu.org> <20191212073738.9C7A3200E3@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="55354"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Stefan Monnier , emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 12 17:11:22 2019 Return-path: Envelope-to: ged-emacs-devel@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 1ifR3h-000EHY-Jp for ged-emacs-devel@m.gmane.org; Thu, 12 Dec 2019 17:11:21 +0100 Original-Received: from localhost ([::1]:33574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifR3f-0002d8-PY for ged-emacs-devel@m.gmane.org; Thu, 12 Dec 2019 11:11:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50100) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifR3Y-0002cj-83 for emacs-devel@gnu.org; Thu, 12 Dec 2019 11:11:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifR3X-0001kb-76 for emacs-devel@gnu.org; Thu, 12 Dec 2019 11:11:12 -0500 Original-Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:55892) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifR3X-0001fT-0W for emacs-devel@gnu.org; Thu, 12 Dec 2019 11:11:11 -0500 Original-Received: by mail-wm1-x32a.google.com with SMTP id q9so2968705wmj.5 for ; Thu, 12 Dec 2019 08:11:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:gmane-reply-to-list:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=BeyIwdICV9e5QpptallYLbiCNG/hNAGYXQW2xadP3Ss=; b=fZfVrAfMTwDLSqFlTYndmkpQYYRT9c2XRpJrtHVSHu987SRF5QOzfcwODpPNih3orF k1ZUJyoI/fMS6/06rlgnjK3a+V3D+7jr+7rx+D3COkJ0s5NsWNnL2cd6M3qTpdwFRFKM 0IwNK6UumTvfBfG5WFZ6aVu9lUkaDx4HvG2n1ooyRgoOmrota9D6EKjXvgXaBj2urrZZ YN3F7dInOgfnPdy8xnYrbify467QoyOAv3KEZXUR0k6kZRUSbQ8r+M9TknO1ZhFHMlTg t8E682J+BZU+Tx1put1bXZJhiTFT3prn4Cd/s+mL05BLX4Hnx0521OXIQqzSdF5uvGSq BPGg== 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 :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=BeyIwdICV9e5QpptallYLbiCNG/hNAGYXQW2xadP3Ss=; b=MCEFE5Rs7IQJakt/11/d0R93SFQkm0Ao421NW5woda9HqFTOEkf838hT3NsdQoRpqe Ed9B/O9zy8YQ2OL7j1DEuoyErF1b3YyZxbcNQiP99EN69oMDzB7w7swtkUKMmhogyjLF 3uyl58UmMeqN8CtY/ARNrfDU//dIXnmXgfwLbvdMx4pW4T+8SDPB52MSEZnbiOij7RMr 51YQkmgYEVIdOdAhVgmM4QHvyVr440af3pWcHAIJUVon5B49G0il5pH6JRg1OrjRNYOY zONV4MjRlRKCDxvW+bUUIGa+uD8loXtvcVP+vTYSYPeFcDF3N67VIQX/+nEurJ3XbJBM ySqg== X-Gm-Message-State: APjAAAXwTmCDvJGmGQnXI0xUpdUEKsUb/fd7YHAjlF/O2vkrlj3xfIiN HZy053Pd9cZFXAIEcM4bDKJhR8M16rVbUQ== X-Google-Smtp-Source: APXvYqyC2lDq2MLJ1r8ni+nqp0e+ahSgnGAYMf2urAOJKa3GUIRyJDrHtUBeJ2qQJygj3F3MGQId2A== X-Received: by 2002:a1c:a795:: with SMTP id q143mr7210290wme.52.1576167069445; Thu, 12 Dec 2019 08:11:09 -0800 (PST) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id v17sm6335814wrt.91.2019.12.12.08.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2019 08:11:08 -0800 (PST) Gmane-Reply-To-List: yes In-Reply-To: (Andreas Schwab's message of "Thu, 12 Dec 2019 16:42:04 +0100") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243327 Archived-At: >>>>> On Thu, 12 Dec 2019 16:42:04 +0100, Andreas Schwab s= aid: 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 dec= oded 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=BC%C3%A9" epg--decode-percent-escape replace the escapes with the corresponding characters, so now we have "=C3=BC=C3=83=C2=A9" when what we really want is "=C3=BC=C3=A9" If we convert the initial string to 'bunch of bytes' before escaping, then convert back to multibyte after, we get the correct answer. Robert