From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71080: 30.0.50; UTF-8 used unconditionally when saving GPG file Date: Mon, 20 May 2024 19:20:55 +0300 Message-ID: <867cfoa1zs.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13281"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71080@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 20 18:22:37 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s95mW-0003Do-RN for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 May 2024 18:22:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s95lv-00040o-Vl; Mon, 20 May 2024 12:22:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s95lt-0003zk-SX for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 12:21:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s95lt-0003fA-K0 for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 12:21:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s95ly-00041k-7y for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 12:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 May 2024 16:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71080 X-GNU-PR-Package: emacs Original-Received: via spool by 71080-submit@debbugs.gnu.org id=B71080.171622208215450 (code B ref 71080); Mon, 20 May 2024 16:22:02 +0000 Original-Received: (at 71080) by debbugs.gnu.org; 20 May 2024 16:21:22 +0000 Original-Received: from localhost ([127.0.0.1]:43440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s95lH-000418-9k for submit@debbugs.gnu.org; Mon, 20 May 2024 12:21:21 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56636) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s95lC-000412-Oh for 71080@debbugs.gnu.org; Mon, 20 May 2024 12:21:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s95l1-0003Ss-8B; Mon, 20 May 2024 12:21:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=UkVtkYr2kntatV4001UrHLbrDeZUdmOWG9Wp/+K9y1Q=; b=VNbXghH8xanz7CELtDg7 1aqpjpXb+KlUCLzfvJcFV4vxNSOCuPsscBqKlD3pbN0tsyMO+4Z8RlY2eaEPpERHQDn5NFMyAYhsY +W7L7t1TA8pcO7gG7JjHGbqPvtQ/uzrZHthTgTOPLTPp3FKXrgOq4sDC3xhWULsGysSrgyGSCPpRe HKj68wNawgNHrt6QZSmytj778OzIKn3hqJ/J2nbw8HjmyJoFnCAp2Ym+4GfvKjqnAXirPPoND3qqD IAaCgxcsItYtveZw7H/DDXC12tFoIMC7xHGtDVw1F+BTbQX64QWoBv7FPPFrDOBVqxEJhzd8s+cWe ybaYf4Szchjxrw==; In-Reply-To: (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285481 Archived-At: > Cc: monnier@iro.umontreal.ca > Date: Mon, 20 May 2024 11:43:31 -0400 > From: Stefan Monnier via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Then > > emacs -Q ~/tmp/foo.txt > C-x C-w foo.gpg RET # To save the file into an encrypted `foo.gpg`. > TAB TAB RET # To select symmetric encryption. > .. type the password you'd like to use ... > M-x revert-buffer RET > > and then you should see that he `λ` turned into its UTF-8 sequence `\316\273`. > The same happens if you encrypt with public keys and if you use any > other encoding that's different from UTF-8. > > AFAICT, the problem is partly due to > > (find-coding-systems-region (point-min) (point-max)) > > returning a list which includes `no-conversion` because in the end the > buffer is saved with "no conversion" (i.e. it uses Emacs's internal > encoding). Another part of the problem is that `find-auto-coding` > returns `no-conversion` for `.gpg` files because those files are binary. > > IOW it can be considered as the result of "no conversion" being > ambiguous, meaning either "binary" or "Emacs's internal encoding" > depending on the circumstances. But it's also due to the confusion > between the encoding to use before encryption (resp. after decryption) > and the encoding to use after encryption (resp. before decryption). > > I don't understand enough of how the "no conversion" ambiguity is > expected to be resolved, nor how the different layers of encoding > are supposed to be handled in file-name-handlers to dig much deeper. How can this work reliably, unless the *.gpg files can have some meta-data that tells Emacs how to decode them? When encoding, we could perhaps use buffer-file-coding-system (AFAICT, we do that indirectly now, via select-safe-coding-system), but what to do when decoding? If _you_ know the correct encoding, you could use "C-x RET c" before the commands (as in "C-x RET c iso-2022-7bit RET C-x C-w"). Did you try that? IOW, I don't think the problem is with 'no-conversion', the problem is that when decoding, we don't really have any useful info for how to decode, and the locale-dependent ad-hoc'ery doesn't help because GPG-encrypted stuff is likely to come from a different locale. You deliberately used iso-2022-7bit, which simulates such an "alien" file. Am I missing something (I know very little about epa, so apologies if what I say makes no sense)?