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#75207: Fwd: bug#75207: 29.4; Path conversion from native codepage to UTF-8 fails when Windows is set by default to UTF-8 Date: Fri, 03 Jan 2025 15:23:48 +0200 Message-ID: <86ed1kghej.fsf@gnu.org> References: <000001db5ab4$06cec970$146c5c50$@0lock.xyz> <3gvOgDDbA00XBG4Xyu7q8lDJKQVYNo4pJ_Uzu35u0KNS8rhQ9PrenO2Kcz7GDHPNtUng9gnBpgPXtHMty_d_Bw==@protonmail.internalid> <86a5cdnfwc.fsf@gnu.org> <003001db5d81$a8f144b0$fad3ce10$@0lock.xyz> <87F91035-E0D9-4650-B332-10E4E8AD0AEF@0lock.xyz> 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="11561"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 75207@debbugs.gnu.org To: =?UTF-8?Q?Micha=C5=82?= Lach Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 03 14:24:58 2025 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 1tThfd-0002sB-8J for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Jan 2025 14:24:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tThep-0006ZX-Id; Fri, 03 Jan 2025 08:24:07 -0500 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 1tThen-0006Z5-G1 for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2025 08:24:05 -0500 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 1tThel-0005Sa-Jr for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2025 08:24:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=HoPDNgzmk2BQSRuRkreqmaIQu3OYDU5+jblNWdFZbkQ=; b=l49zqp2rYaBq4EOcYN98I3PHStpw12TcK5G0z3vFinb9LOCsf6zSlG8dbsT86MxlssMhXZxv7FIHYLtHx6RnbZIPvkGT+utc6SVNJWfmS0g1oM3i201bnf0W7RdiLvf+0hFEH+uDIprwYWfBsNi3N1iQdTqzaIbepSn+rVZ/Ddu+hzEj+BT5cFwGLUqBww5UM72+86XOv6Sl3Z4qqFOp5+5Qtu/WZLdH6+c+5Z7Crg2MxsyH68iJ1AgEoi3J9cdjoov9oZz8DpQH3B+WkDsD/6H73BPzjLl35HAze8IJsjZUK5UtzzZ8o3mrGBvDxGe09MZmo11TuDL682sY21YnlQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tThel-00072s-C5 for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2025 08:24:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Jan 2025 13:24:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75207 X-GNU-PR-Package: emacs Original-Received: via spool by 75207-submit@debbugs.gnu.org id=B75207.173591064227063 (code B ref 75207); Fri, 03 Jan 2025 13:24:03 +0000 Original-Received: (at 75207) by debbugs.gnu.org; 3 Jan 2025 13:24:02 +0000 Original-Received: from localhost ([127.0.0.1]:50015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tThej-00072L-2K for submit@debbugs.gnu.org; Fri, 03 Jan 2025 08:24:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40120) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tTheh-00071t-LY for 75207@debbugs.gnu.org; Fri, 03 Jan 2025 08:24:00 -0500 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 1tTheb-0005RS-Q2; Fri, 03 Jan 2025 08:23:54 -0500 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=HoPDNgzmk2BQSRuRkreqmaIQu3OYDU5+jblNWdFZbkQ=; b=sbMirA+GbL5qfswAnHE/ sbqx31vKnFRypP+7ENzjslO2UtUVqPYjX8GK3/4AdJWJeScHe2syGaIpizziB5wxLQgFRbsdmGqoP wd70r8rp/YZleZ7/TA6x4Tczvy44dFD2RfYQNNDc+n35KXtxv93edQcbFd3X5zTL3FPOnIQTT0+0M ZUvkIEEH39rk+1tq44ZEz2UM8PNaApLZdNkVnNEt8Za3ngGrUOK94hTh8bmEYI62c9sV88ZhlTix9 RjZhOrcjEgoxmIJDS7lodvOIfwKjr31gULMX5xO4njFy4UJa+XQzj81C7OWCnV6iALXWP/z1JLwsO gvIWiWO22o9x7g==; In-Reply-To: <87F91035-E0D9-4650-B332-10E4E8AD0AEF@0lock.xyz> (message from =?UTF-8?Q?Micha=C5=82?= Lach on Fri, 03 Jan 2025 11:49:34 +0000) 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:298276 Archived-At: > Date: Fri, 03 Jan 2025 11:49:34 +0000 > From: Michał Lach > Cc: Eli Zaretskii > > Forgot to CC the bug report mail. > > > Begin forwarded message: > > > > From: > > Subject: RE: bug#75207: 29.4; Path conversion from native codepage to UTF-8 fails when Windows is set by default to UTF-8 > > Date: 3 January 2025 at 02:48:53 CET > > To: "'Eli Zaretskii'" > > Reply-To: > > > > M-: (getenv "ENU") -> nil > > M-: current-locale-environment -> "ENG" > > M-: w32-ansi-code-page -> 65001 > > M-: (default-value 'buffer-file-coding-system) -> iso-latin-1-dos OK. I think I see the problem (and it is not specific to UTF-8 codepage), but just to be sure, please show some more values: M-: w32-multibyte-code-page RET M-: locale-coding-system RET M-: file-name-coding-system RET M-: default-file-name-coding-system RET > > Here is the repro. > > 1. Put a path to your "PATH" environmental variable with some diacritic > > character (ł in my case, maybe it won't work for some) > > 2. M-: exec-path returns gibberish > > > > Here, "Michał" becomes "MichaÅ‚", you can get a similar result if you do > > MultiByteToWideChar using Windows-1252 codepage on a UTF-8 path. We think that PATH is encoded in Windows-1252 codepage, and the question is why and where do we err. The above additional values I ask about might help answer that question. > > I've digged around and it looks like codepage_for_filenames (src/w32.c) at > > somepoint returns the Windows-1252 codepage. > > This is then passed to MultiByteToWideChar() and the scenario that I > > described above happens. > > I've checked this hypothesis with API Monitor and this is what actually > > happens, I can attach a trace if you will find it useful. Not necessary for now, thanks. If I send you a C-level patch, are you able to build Emacs after patching it, preferably the master branch of our Git repository?