GNU bug report logs - #51832
Piping unicode text in `shell-command'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Tor Kringeland <tor.a.s.kringeland@HIDDEN>; dated Sun, 14 Nov 2021 07:06:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 12:31:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 07:31:51 2021
Received: from localhost ([127.0.0.1]:49360 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmEfm-0003WR-U5
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 07:31:51 -0500
Received: from outbound.soverin.net ([116.202.126.228]:60473)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alan@HIDDEN>) id 1mmEfk-0003Pl-HU
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 07:31:49 -0500
Received: from smtp.soverin.net (unknown [10.10.3.28])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
 (No client certificate requested)
 by outbound.soverin.net (Postfix) with ESMTPS id 3A2274F;
 Sun, 14 Nov 2021 12:31:42 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by
 soverin.net
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1636893101; bh=uEFTdFNb+caR4I515RUlWxuO6KbsfgNZdnWwftFbgK4=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=jLBCl8cVm29TnqSLX0kPCYbt1cAmSW9SoiRraYcKTf6Vn0EmJz01zmjZF7ITCoWzA
 XDCmFqFatTxI8m3ADCf3HCHwJMcUZyHZqcdx8z6pf2r+x20sMPtxCqLx+XiGH91SH9
 +DzgwiSNVgJQU48xLe4vygLyolPUPu0cyHDaaANBSSoCO9KYoiRb0oX8t677+zuW5t
 ZI40gOcjMcM8eHYtjyFqXsSKGnPBZ9fg2mWIvXHMQ6xMrqMb0CoT99dYHOvmVeq2rk
 tCtjQULN2poyyLHYnf8OKoKmQ8zz1fBma5qaCGOxOZFo1GYl/PtbXeS9xmC2fpHi6E
 FhygvythkjBRw==
Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95-RC2)
 (envelope-from <alan@HIDDEN>) id 1mmEfY-000LqD-AC;
 Sun, 14 Nov 2021 12:31:36 +0000
Date: Sun, 14 Nov 2021 12:31:36 +0000
From: Alan Third <alan@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#51832: Piping unicode text in `shell-command'
Message-ID: <YZEBqFv8o4sjYKtJ@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, Philipp <p.stephani2@HIDDEN>,
 larsi@HIDDEN, tor.a.s.kringeland@HIDDEN, 51832 <at> debbugs.gnu.org
References: <834k8fw62v.fsf@HIDDEN> <87y25r8968.fsf@HIDDEN>
 <83mtm7upc4.fsf@HIDDEN> <87tugf881r.fsf@HIDDEN>
 <83k0hbuosm.fsf@HIDDEN> <87h7cf84l1.fsf@HIDDEN>
 <87czn383z6.fsf@HIDDEN> <83h7cfuixu.fsf@HIDDEN>
 <9EB4417D-2457-46AD-9198-E42BBAF11071@HIDDEN>
 <83czn3uhtd.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="LJYFIxCLPI4FdEWl"
Content-Disposition: inline
In-Reply-To: <83czn3uhtd.fsf@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 51832
Cc: 51832 <at> debbugs.gnu.org, Philipp <p.stephani2@HIDDEN>, larsi@HIDDEN,
 tor.a.s.kringeland@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--LJYFIxCLPI4FdEWl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Nov 14, 2021 at 12:56:14PM +0200, Eli Zaretskii wrote:
> > From: Philipp <p.stephani2@HIDDEN>
> > Date: Sun, 14 Nov 2021 11:41:38 +0100
> > Cc: Lars Ingebrigtsen <larsi@HIDDEN>,
> >  tor.a.s.kringeland@HIDDEN,
> >  51832 <at> debbugs.gnu.org,
> >  alan@HIDDEN
> > 
> > > I asked once why we push LANG into the environment, instead of calling
> > > setlocale, which would only affect Emacs.  I don't think I saw an
> > > answer to that question, or did I miss it?
> > > 
> > 
> > AIUI the intention is that this should affect subprocesses started from Emacs.  At least that's how I interpret the comment
> > 
> > /* macOS doesn't set any environment variables for the locale when run
> >    from the GUI. Get the locale from the OS and set LANG.  */
> 
> Why is that needed?
> 
> And if it is needed, how come we are setting LANG to an invalid locale
> and the system somehow sets it to the correct locale?

macOS itself doesn't set any locale related environment variables, any
application that is running UNIX style commands is expected to set
them itself. The UNIX commands don't themselves pick up the locale
from the system, they rely on the environment variables.

In other words, as with anything UNIXy on macOS, it's a badly thought
out mess.

It seems suspicious to me that we've had this code since Emacs 26, but
only in the last few weeks we've had two complaints about it. Having
dug out my Mac I can't convince it to show any of the errors that have
been reported, so I suspect either the latest version of macOS has
made the locale handling much more strict or has removed a lot of
locales.

I've attached a patch that may do something towards preventing this
problem but ultimately this is a convenience to give a best guess at
choosing the correct dictionary, date format, etc. If we can't easily
fix it then we can drop it and tell people to set it in their init.el
themselves.

-- 
Alan Third

--LJYFIxCLPI4FdEWl
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="0001-Only-set-LANG-if-the-ID-is-valid.patch"

From ff67f1cbee3c0b1fd5b1a0d725e40158190cfe55 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@HIDDEN>
Date: Sun, 14 Nov 2021 11:32:54 +0000
Subject: [PATCH] Only set LANG if the ID is valid

* src/nsterm.m (ns_init_locale): Check the provided locale identifier
is available before trying to use it.
---
 src/nsterm.m | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 1f17a30272..566537e8a1 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -535,21 +535,25 @@ - (NSColor *)colorUsingDefaultColorSpace
 
   NSTRACE ("ns_init_locale");
 
-  @try
+  if ([[NSLocale availableLocaleIdentifiers]
+        containsObject:[locale localeIdentifier]])
     {
-      /* It seems macOS should probably use UTF-8 everywhere.
-         'localeIdentifier' does not specify the encoding, and I can't
-         find any way to get the OS to tell us which encoding to use,
-         so hard-code '.UTF-8'.  */
-      NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
-                                     [locale localeIdentifier]];
-
-      /* Set LANG to locale, but not if LANG is already set.  */
-      setenv("LANG", [localeID UTF8String], 0);
-    }
-  @catch (NSException *e)
-    {
-      NSLog (@"Locale detection failed: %@: %@", [e name], [e reason]);
+      @try
+        {
+          /* It seems macOS should probably use UTF-8 everywhere.
+             'localeIdentifier' does not specify the encoding, and I can't
+             find any way to get the OS to tell us which encoding to use,
+             so hard-code '.UTF-8'.  */
+          NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
+                                         [locale localeIdentifier]];
+
+          /* Set LANG to locale, but not if LANG is already set.  */
+          setenv("LANG", [localeID UTF8String], 0);
+        }
+      @catch (NSException *e)
+        {
+          NSLog (@"Locale detection failed: %@: %@", [e name], [e reason]);
+        }
     }
 }
 
-- 
2.33.0


--LJYFIxCLPI4FdEWl--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 12:17:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 07:17:12 2021
Received: from localhost ([127.0.0.1]:49341 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmERc-0001WC-Ff
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 07:17:12 -0500
Received: from eggs.gnu.org ([209.51.188.92]:59436)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1mmERZ-0001Vy-Jk
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 07:17:11 -0500
Received: from [2001:470:142:3::e] (port=52600 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmERT-0004i9-JN; Sun, 14 Nov 2021 07:17:03 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=weE+MIhNn+pMYfU1NAPZ7RPG1yRtGFZIcdh0CGGu9Fs=; b=muGJLF3iiVck
 e+HbJJyEq3Nqxdnu3X9FDMuYKxAdwwU1ThpUDkdlkqKb+VaFphaMs+9N76hCwG+yk2cJLs1+1y84R
 OTwbuKIgWXJyHlYeNv56QHdCBSaFkrJ+FPG3EAbF7Z1ervh4DfK95GjeFApwIJJcNiTPPN1/FtfF0
 dMuyc8vvgbY5ZzM6ZWkcpzl698d1EXFFOp4+xtj8oEZhn9xhGlR9Dx3Zs5NZbvOaK+Akt7AY8DAnU
 ou+aD3t6IEYnQF4sDUSpZs/q12YRZoMwhspazn+wWfpS2Rz172LNF8IFrdPkNlSFnRVlt76KYDt+G
 tEDBSQmpqiOVkEXXG7i5qQ==;
Received: from [87.69.77.57] (port=3251 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmERT-0002OJ-6E; Sun, 14 Nov 2021 07:17:03 -0500
Date: Sun, 14 Nov 2021 14:16:49 +0200
Message-Id: <838rxrue32.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
In-Reply-To: <87zgq76l24.fsf@HIDDEN> (message from Lars Ingebrigtsen on Sun, 
 14 Nov 2021 12:20:03 +0100)
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN>
 <87tugf881r.fsf@HIDDEN> <83k0hbuosm.fsf@HIDDEN>
 <87h7cf84l1.fsf@HIDDEN> <87czn383z6.fsf@HIDDEN>
 <83h7cfuixu.fsf@HIDDEN>
 <9EB4417D-2457-46AD-9198-E42BBAF11071@HIDDEN>
 <83czn3uhtd.fsf@HIDDEN> <87zgq76l24.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: 51832 <at> debbugs.gnu.org, p.stephani2@HIDDEN, tor.a.s.kringeland@HIDDEN,
 alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lars Ingebrigtsen <larsi@HIDDEN>
> Cc: Philipp <p.stephani2@HIDDEN>,  tor.a.s.kringeland@HIDDEN,
>   51832 <at> debbugs.gnu.org,  alan@HIDDEN
> Date: Sun, 14 Nov 2021 12:20:03 +0100
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > And if it is needed, how come we are setting LANG to an invalid locale
> > and the system somehow sets it to the correct locale?
> 
> LANG outside of Emacs is "" for me on Macos.

And that doesn't work when running applications from inside Emacs?  If
it does work, why do we set LANG in Emacs?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 11:48:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 06:48:30 2021
Received: from localhost ([127.0.0.1]:49315 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmDzq-00070X-Gr
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 06:48:30 -0500
Received: from mail-wr1-f42.google.com ([209.85.221.42]:40885)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <p.stephani2@HIDDEN>) id 1mmDzp-00070H-IS
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 06:48:30 -0500
Received: by mail-wr1-f42.google.com with SMTP id r8so24542719wra.7
 for <51832 <at> debbugs.gnu.org>; Sun, 14 Nov 2021 03:48:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=bh+jVpl7udP+AnE8eULQpHNh+yaDPAdYEV5a8oDWwps=;
 b=PPtZ11S6/kQWL+wgE4Tttgw1UGWL0B3aahHSdkOxbUjN/lI4jQRVEh0vpoVlsUBHm3
 LC3IkdrbqYz+/lgHb9prEnDQox5CEUF/m3Sk8vJP1Gj3LK7jKtG9gWTcdz4Z2G8NNRRU
 UXVLbY1TgB6BIaxt7ZSfQBKA+qyD3rMqKPMy+TW+qJJTSlalM0UhFn2zejuOACn77PvW
 SEsm53nemhDpvhbtkHnASrP6VgqS/jxTvl/LAVxU2yZ/52cya9QrMjooKsdDvibhXo4Q
 W+6ql+EJJksNFhMITnpoEpxpZ9/fD1X90Nvty0lSZodKX1z/3aQLxzXICm3628l2Xerj
 vNrg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=bh+jVpl7udP+AnE8eULQpHNh+yaDPAdYEV5a8oDWwps=;
 b=nU90nJly7T2MOaAgMLt7hWKRaz1Bw9t/9fQOfgru6J6XDg1AgrFoIn0+8u0TEnE6Q4
 B2nV6hy0U9uRiJlfcmyeittj/tb2Uer60ExFYNkc61bmec8yCnIGZ4Gs1T796goEJWBD
 6eu7b4NwAdBrZ/5Qo9GrPbrNj1DhEplKjfqfnS/Ks7CSHetezD/gCtND6xZMFmkZro78
 yHzgvtrHv0HSSMpagFKgQacA0iKuzKu1st9NX0A8/xb4JJPYuOVpQEJm27vYlZsLv7Y0
 BghUzykoInLuR/TucvB/Uy/zkyRtahlKv2ZbLb7eVs/gaHDSSLm0NKfhg5t781eOWdlC
 35jw==
X-Gm-Message-State: AOAM533Ppsg9wWG8yBJX2NEtXgj6akVi/snX7c04kUMCc6A2O/SQll8k
 7hwpKsMjA5xjRHemXczTENw=
X-Google-Smtp-Source: ABdhPJz62IxeMGhyd6QMQSUGAf88ruptX9dYO9+D9rdbeb7tfdjeMawVFDFaGP4B36blIZMgFgrDhQ==
X-Received: by 2002:a05:6000:1788:: with SMTP id
 e8mr37228105wrg.45.1636890503527; 
 Sun, 14 Nov 2021 03:48:23 -0800 (PST)
Received: from smtpclient.apple (p57aafa06.dip0.t-ipconnect.de. [87.170.250.6])
 by smtp.gmail.com with ESMTPSA id z12sm11046824wrv.78.2021.11.14.03.48.22
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 14 Nov 2021 03:48:23 -0800 (PST)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\))
Subject: Re: bug#51832: Piping unicode text in `shell-command'
From: Philipp <p.stephani2@HIDDEN>
In-Reply-To: <87zgq76l24.fsf@HIDDEN>
Date: Sun, 14 Nov 2021 12:48:21 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <22556E9A-A4EA-4A25-AB42-B7ADD3681730@HIDDEN>
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN> <87tugf881r.fsf@HIDDEN>
 <83k0hbuosm.fsf@HIDDEN> <87h7cf84l1.fsf@HIDDEN> <87czn383z6.fsf@HIDDEN>
 <83h7cfuixu.fsf@HIDDEN> <9EB4417D-2457-46AD-9198-E42BBAF11071@HIDDEN>
 <83czn3uhtd.fsf@HIDDEN> <87zgq76l24.fsf@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
X-Mailer: Apple Mail (2.3693.20.0.1.32)
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 51832
Cc: 51832 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 tor.a.s.kringeland@HIDDEN, alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)



> Am 14.11.2021 um 12:20 schrieb Lars Ingebrigtsen <larsi@HIDDEN>:
>=20
> Eli Zaretskii <eliz@HIDDEN> writes:
>=20
>> And if it is needed, how come we are setting LANG to an invalid =
locale
>> and the system somehow sets it to the correct locale?
>=20
> LANG outside of Emacs is "" for me on Macos.

For reference, on my Monterey system, only the following variables are =
initially set when launching Emacs from Finder:

__CF_USER_TEXT_ENCODING=3D0x1F5:0x0:0x3
__CFBundleIdentifier=3Dorg.gnu.Emacs
COMMAND_MODE=3Dunix2003
DISPLAY=3D/private/tmp/com.apple.launchd.[...]/org.macosforge.xquartz:0
HOME=3D/Users/p
LOGNAME=3Dp
PATH=3D/usr/bin:/bin:/usr/sbin:/sbin
SHELL=3D/opt/homebrew/bin/bash
SSH_AUTH_SOCK=3D/private/tmp/com.apple.launchd.[...]/Listeners
TMPDIR=3D/var/folders/hw/[...]/T/
USER=3Dp
XPC_FLAGS=3D0x0
XPC_SERVICE_NAME=3Dapplication.org.gnu.Emacs.[...]





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 11:20:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 06:20:16 2021
Received: from localhost ([127.0.0.1]:49277 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmDYW-00065b-7H
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 06:20:16 -0500
Received: from quimby.gnus.org ([95.216.78.240]:59554)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mmDYU-00065K-Cx
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 06:20:14 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=gXwYjAg93njvhtNtN4xW0FrqTk4T6N44jrDaJheRN7U=; b=lgDsRMfIgusAWxDWzuAyEWtXux
 QujaI9jp25F29JDhXRBuhMDqroQegb3n0YemniZEo6LrcACG6l394Xke2RM8uagJ1jpsjGO0my2vm
 MGU60yQ53mBGyvXDinYX6i+iXMFB47+2LMwjNCiDpHc10Y30xpICrcSCZmW2uxP4viyY=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mmDYJ-0003Fg-OF; Sun, 14 Nov 2021 12:20:06 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN>
 <87tugf881r.fsf@HIDDEN> <83k0hbuosm.fsf@HIDDEN>
 <87h7cf84l1.fsf@HIDDEN> <87czn383z6.fsf@HIDDEN>
 <83h7cfuixu.fsf@HIDDEN>
 <9EB4417D-2457-46AD-9198-E42BBAF11071@HIDDEN>
 <83czn3uhtd.fsf@HIDDEN>
X-Now-Playing: Mia Doi Todd's _Music Life_: "Daughter of Hope"
Date: Sun, 14 Nov 2021 12:20:03 +0100
In-Reply-To: <83czn3uhtd.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 14 Nov
 2021 12:56:14 +0200")
Message-ID: <87zgq76l24.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Eli Zaretskii <eliz@HIDDEN> writes: > And if it is needed, 
 how come we are setting LANG to an invalid locale > and the system somehow
 sets it to the correct locale? LANG outside of Emacs is "" for me on Macos.
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: 51832 <at> debbugs.gnu.org, Philipp <p.stephani2@HIDDEN>,
 tor.a.s.kringeland@HIDDEN, alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

> And if it is needed, how come we are setting LANG to an invalid locale
> and the system somehow sets it to the correct locale?

LANG outside of Emacs is "" for me on Macos.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 10:56:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 05:56:36 2021
Received: from localhost ([127.0.0.1]:49260 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmDBb-0005Tn-NX
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 05:56:35 -0500
Received: from eggs.gnu.org ([209.51.188.92]:48406)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1mmDBa-0005TX-BX
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 05:56:34 -0500
Received: from [2001:470:142:3::e] (port=50974 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmDBU-0002y3-3X; Sun, 14 Nov 2021 05:56:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Tuwxb9KX8GRSmCyjBuap2ljWvViI4u5jkJ0ANzcjQh8=; b=Zw/n0Ne4OaaV
 6LlSN8OlRWNbH2v2dH/k7aYefjd2GNRCOhbldgVWyfmW4WBsAFlmyoFlqeosHujknPfLtsGYsl+Uv
 1BmMtS3qUyJJbHUVNYef3f/ctOhittnDJezOmPDWdIlqna9dNiksvYwXE7tjTJNYcC+fP4BBJFsyI
 ckwdLtbg3FmuW1BCDzFeT3RQSqGDDLkqCB6AOK9t+/NZmdX9no7x7PT7QUory64ngl+91P+QPw/hb
 fmgUEU389lU1GPybk4gNMeW+Xcrimplq+l+XNygSHAZj+MsE8fqR12KprizDH7DmMO0Ql4KekKh60
 ei9U0RQVq5KdnUORqZQWnQ==;
Received: from [87.69.77.57] (port=2331 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmDBT-0001sQ-Mt; Sun, 14 Nov 2021 05:56:28 -0500
Date: Sun, 14 Nov 2021 12:56:14 +0200
Message-Id: <83czn3uhtd.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Philipp <p.stephani2@HIDDEN>
In-Reply-To: <9EB4417D-2457-46AD-9198-E42BBAF11071@HIDDEN> (message from
 Philipp on Sun, 14 Nov 2021 11:41:38 +0100)
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN> <87tugf881r.fsf@HIDDEN>
 <83k0hbuosm.fsf@HIDDEN> <87h7cf84l1.fsf@HIDDEN> <87czn383z6.fsf@HIDDEN>
 <83h7cfuixu.fsf@HIDDEN> <9EB4417D-2457-46AD-9198-E42BBAF11071@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: 51832 <at> debbugs.gnu.org, larsi@HIDDEN, tor.a.s.kringeland@HIDDEN,
 alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Philipp <p.stephani2@HIDDEN>
> Date: Sun, 14 Nov 2021 11:41:38 +0100
> Cc: Lars Ingebrigtsen <larsi@HIDDEN>,
>  tor.a.s.kringeland@HIDDEN,
>  51832 <at> debbugs.gnu.org,
>  alan@HIDDEN
> 
> > I asked once why we push LANG into the environment, instead of calling
> > setlocale, which would only affect Emacs.  I don't think I saw an
> > answer to that question, or did I miss it?
> > 
> 
> AIUI the intention is that this should affect subprocesses started from Emacs.  At least that's how I interpret the comment
> 
> /* macOS doesn't set any environment variables for the locale when run
>    from the GUI. Get the locale from the OS and set LANG.  */

Why is that needed?

And if it is needed, how come we are setting LANG to an invalid locale
and the system somehow sets it to the correct locale?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 10:41:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 05:41:49 2021
Received: from localhost ([127.0.0.1]:49250 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmCxI-00054Q-VW
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 05:41:49 -0500
Received: from mail-wr1-f43.google.com ([209.85.221.43]:36429)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <p.stephani2@HIDDEN>) id 1mmCxG-00054B-FS
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 05:41:47 -0500
Received: by mail-wr1-f43.google.com with SMTP id s13so24410363wrb.3
 for <51832 <at> debbugs.gnu.org>; Sun, 14 Nov 2021 02:41:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=V54mFRfVr5Jxducvoi+ce83BCUXvDKO3WQsGQ9qtVhQ=;
 b=hZnnym+ygJIruVe+Ser50NnXa0CNE56aU1tHogxrweZvdcC9mO5hnnbxOG0PX/FEXe
 zod+bf+mWzLEmGqlEEK8TzYD40s+Xc7qUHRpx4x28L8g/JJJ+o+BMCqqvvlA1pC27Ljw
 KZzAkZXaJUKqodK7E0qTJwhYOOzIZ/n4LS2JlykF+UrTM0DqRvXmfOGg2nke6TnMWMcd
 dn1VsZP34ZN16Q45mbVbokaRbKNnUKScr5Tu5QdhRXVAZSv5dkcuVyl7C1jCXqnUOwwR
 8ICrvO3zCx9LvBZtxuHmpfQGTSaoOwB2rppwKSKB5IPriUy7PpNpwg/WCrnTUojLcw4o
 mYcg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=V54mFRfVr5Jxducvoi+ce83BCUXvDKO3WQsGQ9qtVhQ=;
 b=2g6xQ5kxK/ksxBWiCUM6vKGQqSCJ+jr5fd9H8wr4U1hZOBATx3aiDhDtb6qafJ5z06
 v7AnbHufgsriKKwgoID6Lii/tF/uQg6Ldq1S3ksNk/dXh+vzKjGCQlIglgCBYzJVI7M0
 LXDl3IyDMadLEtfoUypnPr+BYUEq4/Ee606zyKgtaCEJslkH/72gCgo6rHmnPhplcREa
 xhKx37h5HHGVXcphWHOBkYJ6YK0aKE/Mbvx0hkRwa0QYuyr1Br7F2YBJvj6P8CjPLH0S
 JyaB5ZfvZdP9kTQYwtrUdKir6hhPGyOOGfy2H3J4Yb3m1FLOi2wXnVRJ9IJf3VaX2/0M
 22Mg==
X-Gm-Message-State: AOAM533jPKpaQBLC2uMV01o+h9pDDhdKPMdqg6R75e/4mmmvrhDyLiTz
 BkddC6udjRHVUN/J46lxO48=
X-Google-Smtp-Source: ABdhPJzhXMRnZPwpqC3B/VQl5jQQcQC7H7bLlfJE7rruJwIwLxgfBNoLKM1VBpDD14J+CDGBqt4nag==
X-Received: by 2002:a5d:584e:: with SMTP id i14mr37705065wrf.386.1636886500447; 
 Sun, 14 Nov 2021 02:41:40 -0800 (PST)
Received: from smtpclient.apple (p57aafa06.dip0.t-ipconnect.de. [87.170.250.6])
 by smtp.gmail.com with ESMTPSA id h16sm12077922wrm.27.2021.11.14.02.41.39
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 14 Nov 2021 02:41:40 -0800 (PST)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\))
Subject: Re: bug#51832: Piping unicode text in `shell-command'
From: Philipp <p.stephani2@HIDDEN>
In-Reply-To: <83h7cfuixu.fsf@HIDDEN>
Date: Sun, 14 Nov 2021 11:41:38 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <9EB4417D-2457-46AD-9198-E42BBAF11071@HIDDEN>
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN> <87tugf881r.fsf@HIDDEN>
 <83k0hbuosm.fsf@HIDDEN> <87h7cf84l1.fsf@HIDDEN> <87czn383z6.fsf@HIDDEN>
 <83h7cfuixu.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3693.20.0.1.32)
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 51832
Cc: 51832 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>,
 tor.a.s.kringeland@HIDDEN, alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)



> Am 14.11.2021 um 11:31 schrieb Eli Zaretskii <eliz@HIDDEN>:
>=20
>> From: Lars Ingebrigtsen <larsi@HIDDEN>
>> Cc: tor.a.s.kringeland@HIDDEN,  51832 <at> debbugs.gnu.org,  =
alan@HIDDEN
>> Date: Sun, 14 Nov 2021 10:46:05 +0100
>>=20
>>  NSLocale *locale =3D [NSLocale currentLocale];
>>=20
>>  NSTRACE ("ns_init_locale");
>>=20
>>  @try
>>    {
>>      /* It seems macOS should probably use UTF-8 everywhere.
>>         'localeIdentifier' does not specify the encoding, and I can't
>>         find any way to get the OS to tell us which encoding to use,
>>         so hard-code '.UTF-8'.  */
>>      NSString *localeID =3D [NSString stringWithFormat:@"%@.UTF-8",
>>                                     [locale localeIdentifier]];
>>=20
>>      /* Set LANG to locale, but not if LANG is already set.  */
>>      setenv("LANG", [localeID UTF8String], 0);
>>    }
>>=20
>> And...  it's a Macos bug?  Googling a bit seems to say that this does
>> indeed return invalid locale identifiers -- just language glued =
together
>> with the country, resulting in identifiers that doesn't match any
>> locales the OS knows about.
>>=20
>> So...  I don't know what to do about that.  Is there a way to check =
that
>> the identifier is valid?
>=20
> I asked once why we push LANG into the environment, instead of calling
> setlocale, which would only affect Emacs.  I don't think I saw an
> answer to that question, or did I miss it?
>=20

AIUI the intention is that this should affect subprocesses started from =
Emacs.  At least that's how I interpret the comment

/* macOS doesn't set any environment variables for the locale when run
   from the GUI. Get the locale from the OS and set LANG.  */





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 10:32:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 05:32:20 2021
Received: from localhost ([127.0.0.1]:49240 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmCo7-0004q1-NT
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 05:32:19 -0500
Received: from eggs.gnu.org ([209.51.188.92]:45242)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1mmCo5-0004po-Vf
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 05:32:18 -0500
Received: from [2001:470:142:3::e] (port=50364 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmCnz-0000Jv-TA; Sun, 14 Nov 2021 05:32:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=lwhqPFNi9x8sxUJdOrNtI7TSOFC65832rSsa54eAWlY=; b=DfooETk42Bgm
 NDGMgXpTX36c1TxPE5+/WNy0nVPex5zWLtSaQjIG8LEsi0Yj1DGOFIeDskzfHgx6SPxTJbqprUDWj
 IlK39i4mBpQ6qzJP1YQD1Sw18SeEL3+Gb58hQm1AZDaR06VJ6PBfkQeXzTPZ8WY21DTJcuSjsg77o
 DrjLVxEcku2nzvJMXzomPCn2kVAvSDy+SGQAv1QtLaVpbeQ9qEd1aOhETppMqCrRTbi4R+X/u4R8R
 ZVoYrFttJ/gqqwV7SURCtebm748vJxGirBNFplB8hp2JpOtAb+PaXndF3Ryol1FVlcOjA7fb0ikeh
 +yIe2EeZkuIcWiVajid6Xg==;
Received: from [87.69.77.57] (port=4815 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmCny-0003XM-T1; Sun, 14 Nov 2021 05:32:11 -0500
Date: Sun, 14 Nov 2021 12:31:57 +0200
Message-Id: <83h7cfuixu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
In-Reply-To: <87czn383z6.fsf@HIDDEN> (message from Lars Ingebrigtsen on Sun, 
 14 Nov 2021 10:46:05 +0100)
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN>
 <87tugf881r.fsf@HIDDEN> <83k0hbuosm.fsf@HIDDEN>
 <87h7cf84l1.fsf@HIDDEN> <87czn383z6.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: tor.a.s.kringeland@HIDDEN, 51832 <at> debbugs.gnu.org, alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lars Ingebrigtsen <larsi@HIDDEN>
> Cc: tor.a.s.kringeland@HIDDEN,  51832 <at> debbugs.gnu.org,  alan@HIDDEN
> Date: Sun, 14 Nov 2021 10:46:05 +0100
> 
>   NSLocale *locale = [NSLocale currentLocale];
> 
>   NSTRACE ("ns_init_locale");
> 
>   @try
>     {
>       /* It seems macOS should probably use UTF-8 everywhere.
>          'localeIdentifier' does not specify the encoding, and I can't
>          find any way to get the OS to tell us which encoding to use,
>          so hard-code '.UTF-8'.  */
>       NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
>                                      [locale localeIdentifier]];
> 
>       /* Set LANG to locale, but not if LANG is already set.  */
>       setenv("LANG", [localeID UTF8String], 0);
>     }
> 
> And...  it's a Macos bug?  Googling a bit seems to say that this does
> indeed return invalid locale identifiers -- just language glued together
> with the country, resulting in identifiers that doesn't match any
> locales the OS knows about.
> 
> So...  I don't know what to do about that.  Is there a way to check that
> the identifier is valid?

I asked once why we push LANG into the environment, instead of calling
setlocale, which would only affect Emacs.  I don't think I saw an
answer to that question, or did I miss it?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 09:46:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 04:46:20 2021
Received: from localhost ([127.0.0.1]:49141 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmC5b-0003YI-PJ
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 04:46:19 -0500
Received: from quimby.gnus.org ([95.216.78.240]:58824)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mmC5a-0003Y4-0J
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 04:46:18 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=wgTsLpr4KByPItnkhmOuaUjL3AhXYXGGTmIGdpTHIWk=; b=c5ANLF0tG/Dd4WVUoylY33nJCn
 EaiRPbhyi6fy1NyuO0X1KRCwY8YcqfiAIZPgzeMO9/BYyxGmHrT4uLTdpllc/TUTP5oiLSx3xNSOy
 wt0RLJAJ9jUH11yZDPt/gRobykcc1EoBPK5E7H61/waPD6tJwQF99E3XtE6k0H2l2Sfw=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mmC5Q-0002eP-2t; Sun, 14 Nov 2021 10:46:10 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN>
 <87tugf881r.fsf@HIDDEN> <83k0hbuosm.fsf@HIDDEN>
 <87h7cf84l1.fsf@HIDDEN>
X-Now-Playing: Colleen's _The Tunnel and the Clearing_: "Hidden in the Current"
Date: Sun, 14 Nov 2021 10:46:05 +0100
In-Reply-To: <87h7cf84l1.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sun,
 14 Nov 2021 10:32:58 +0100")
Message-ID: <87czn383z6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Lars Ingebrigtsen <larsi@HIDDEN> writes: > doesn't. And
 that's the setting in Emacs for me. It's correct that I > am in Norway and
 that I'm using the English locale, but there's no such > locale as en_NO.utf-8.
 > > Didn't Emacs on Macos rece [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: tor.a.s.kringeland@HIDDEN, 51832 <at> debbugs.gnu.org, alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> doesn't.  And that's the setting in Emacs for me.  It's correct that I
> am in Norway and that I'm using the English locale, but there's no such
> locale as en_NO.utf-8.
>
> Didn't Emacs on Macos recently get some locale-related changes?

It's this code, I guess, from 2016, so it's not recent:

  NSLocale *locale = [NSLocale currentLocale];

  NSTRACE ("ns_init_locale");

  @try
    {
      /* It seems macOS should probably use UTF-8 everywhere.
         'localeIdentifier' does not specify the encoding, and I can't
         find any way to get the OS to tell us which encoding to use,
         so hard-code '.UTF-8'.  */
      NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
                                     [locale localeIdentifier]];

      /* Set LANG to locale, but not if LANG is already set.  */
      setenv("LANG", [localeID UTF8String], 0);
    }

And...  it's a Macos bug?  Googling a bit seems to say that this does
indeed return invalid locale identifiers -- just language glued together
with the country, resulting in identifiers that doesn't match any
locales the OS knows about.

So...  I don't know what to do about that.  Is there a way to check that
the identifier is valid?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 09:33:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 04:33:12 2021
Received: from localhost ([127.0.0.1]:49126 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmBst-0003DT-Qw
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 04:33:11 -0500
Received: from quimby.gnus.org ([95.216.78.240]:58580)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mmBsr-0003DC-8k
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 04:33:09 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
 :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=xgvp9w1PJIx4swWhQE1vUR0KRAz32hnpuAldii29krg=; b=CeUMP24U4iOkMGD1XQqIySiZbM
 0oGPE3zCbWyx9EkLZHbFGbIEas0poQu5w6p6oQpnw0Iq2wBakIIOmJi0vit7F/N7QdfCCfS5/fwqI
 15uw09gWHGO9BWkPIBTw3vVqVFT5m3kcDuHV1O452N8P4adddpzLMZWEWR4b5XrUdhFo=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mmBsh-0002Yl-20; Sun, 14 Nov 2021 10:33:02 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN>
 <87tugf881r.fsf@HIDDEN> <83k0hbuosm.fsf@HIDDEN>
X-Now-Playing: Colleen's _The Tunnel and the Clearing_: "The Tunnel and the
 Clearing"
Date: Sun, 14 Nov 2021 10:32:58 +0100
In-Reply-To: <83k0hbuosm.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 14 Nov
 2021 10:25:29 +0200")
Message-ID: <87h7cf84l1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 
 Content preview:  It's a bug in... the locale settings. Testing in the console,
    echo fóo | LANG=en_US.utf-8 pbcopy works fine, but 
 
 Content analysis details:   (-2.9 points, 5.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                             [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: tor.a.s.kringeland@HIDDEN, 51832 <at> debbugs.gnu.org, alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

It's a bug in...  the locale settings.  Testing in the console,

echo f=C3=B3o | LANG=3Den_US.utf-8 pbcopy

works fine, but

echo f=C3=B3o | LANG=3Den_NO.utf-8 pbcopy

doesn't.  And that's the setting in Emacs for me.  It's correct that I
am in Norway and that I'm using the English locale, but there's no such
locale as en_NO.utf-8.

Didn't Emacs on Macos recently get some locale-related changes?

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 09:19:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 04:19:26 2021
Received: from localhost ([127.0.0.1]:49119 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmBfa-0002qK-II
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 04:19:26 -0500
Received: from quimby.gnus.org ([95.216.78.240]:58518)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mmBfY-0002q7-UN
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 04:19:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
 :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=0qoHpF9v8xeVsBlLMMjcOI7eVkHYDQtHEZd0z6r005s=; b=e4KtvzBv5taiRLdSXyfHhXS8sP
 O02mfQNzZKFR3XwyfKDXcuRTgCSqS/Q8WXWW69f5x9d8oBXnS+Y5r/R3iIZB3hEiKl8OWYG/y4bEw
 84ToHavzHL/40vkVz90+rDAAl74ZHbLEJUzL+hxG0tfd3UAZUz32EuNdVqrsy902xHqU=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mmBfO-0002Ue-V6; Sun, 14 Nov 2021 10:19:17 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN>
 <87tugf881r.fsf@HIDDEN> <83k0hbuosm.fsf@HIDDEN>
X-Now-Playing: Colleen's _The Tunnel and the Clearing_: "Revelation"
Date: Sun, 14 Nov 2021 10:19:13 +0100
In-Reply-To: <83k0hbuosm.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 14 Nov
 2021 10:25:29 +0200")
Message-ID: <87lf1r857y.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Eli Zaretskii <eliz@HIDDEN> writes: > Maybe we set some
 locale-related
 environment variable, and that was > confuses pbcopy when it is run from
 Emacs? I've now followed the call tree, and we end up doing: 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: tor.a.s.kringeland@HIDDEN, 51832 <at> debbugs.gnu.org, alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

> Maybe we set some locale-related environment variable, and that was
> confuses pbcopy when it is run from Emacs?

I've now followed the call tree, and we end up doing:

(call-process-region (point) (point) shell-file-name nil
                     (current-buffer) nil shell-command-switch
                     "echo foo=F0=9F=98=80bar | pbcopy")

And that fails, too.  So it's not something that shell-command sets up
(if it's a locale-related thing).

Hm...  Oh!  I thought the original report said that this worked if run
under M-x shell.  But it doesn't -- I get the same garbled selection.
(And it works fine in a shell outside Emacs.)

So it could indeed be a locale setting in Emacs that's making pbcopy do
the wrong thing.=20

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 08:25:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 03:25:53 2021
Received: from localhost ([127.0.0.1]:49080 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmApl-0001Ra-5Q
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 03:25:53 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58512)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1mmApi-0001RM-KX
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 03:25:51 -0500
Received: from [2001:470:142:3::e] (port=47278 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmApd-0003gq-0S; Sun, 14 Nov 2021 03:25:45 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=3QBpx5PREuaRSF7GJVycn/qkKat/O7ilXXCSbo8eccw=; b=CpRktKnK+ZQN
 FBv8qeIoo+ciKm0A5tXKe+0ngJEpIc6X6uHht3mWbBzjxr9cFS/0JnxDB3YFn3HI3PDpX1Mz6FQI7
 1QU+7V7bvll5RunlyDsM6X/4Smf54vqnd0OLAyD5babrE0rgNjmiindZOF5IIAZbaFl/M1ONob0Fs
 I1ePtPScXOkye6kQjoeykOkzTrXwbOmR+PE04wOMOnfT+a1ico2t0hbhIa7ugDnJjcv9Ad5GrHyP3
 gBRj4yGAuZaJHLSroGvFb6LFnzsncZAL+9QhSFpulwdrZ2M7uiLklO3A+PLqn63ll6BRl6V0LLvWd
 wOXQrb/Z8VZwABark/cLOw==;
Received: from [87.69.77.57] (port=4888 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmApc-0000J6-KQ; Sun, 14 Nov 2021 03:25:44 -0500
Date: Sun, 14 Nov 2021 10:25:29 +0200
Message-Id: <83k0hbuosm.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
In-Reply-To: <87tugf881r.fsf@HIDDEN> (message from Lars Ingebrigtsen on Sun, 
 14 Nov 2021 09:18:08 +0100)
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN> <87tugf881r.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: tor.a.s.kringeland@HIDDEN, 51832 <at> debbugs.gnu.org, alan@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lars Ingebrigtsen <larsi@HIDDEN>
> Cc: tor.a.s.kringeland@HIDDEN,  51832 <at> debbugs.gnu.org, Alan Third
>  <alan@HIDDEN>
> Date: Sun, 14 Nov 2021 09:18:08 +0100
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > It could be useful to replace the pipe with redirection to a file, and
> > see what you get when invoking the command from Emacs and from a shell
> > prompt outside Emacs.
> 
> Good point.  I tried that now (with "| cat > /tmp/" to get a pipe in
> there), and the contents that were written to file were correct utf-8.
> 
> Mysterious.  Could the problem be in pbcopy -- that's assuming something
> about the coding system when run from inside Emacs somehow?  That
> doesn't sound very likely, but...

Maybe we set some locale-related environment variable, and that was
confuses pbcopy when it is run from Emacs?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 08:18:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 03:18:23 2021
Received: from localhost ([127.0.0.1]:49075 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmAiV-0001G6-Bq
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 03:18:23 -0500
Received: from quimby.gnus.org ([95.216.78.240]:58076)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mmAiT-0001Ft-F1
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 03:18:21 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=K0NfSL3R5um7gAQRKIUPXZvF+1DyOXiLRksh4eWKPmQ=; b=Nay2MbvRxzslGpMJei68OeJqcW
 eEY5+5/KmrXsiac3qQchf/HVW1xtn1B/YYdeFjpSls6ze8rZDiKFqAg+MP9Kh7JDC5F/UVSbp8+zr
 rnNqh62diY2io001sG1Aee7qnj1GJLiKhxQIAWf/fjr+NguUabmo5NFnNx4OaMuH5Fvc=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mmAiJ-000253-Sx; Sun, 14 Nov 2021 09:18:14 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN> <83mtm7upc4.fsf@HIDDEN>
X-Now-Playing: Schneider TM's _The 8 Of Space_: "The Trip (Is The Goal)"
Date: Sun, 14 Nov 2021 09:18:08 +0100
In-Reply-To: <83mtm7upc4.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 14 Nov
 2021 10:13:47 +0200")
Message-ID: <87tugf881r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Eli Zaretskii <eliz@HIDDEN> writes: > It could be useful
 to replace the pipe with redirection to a file, and > see what you get when
 invoking the command from Emacs and from a shell > prompt outside Emacs. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: tor.a.s.kringeland@HIDDEN, 51832 <at> debbugs.gnu.org,
 Alan Third <alan@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

> It could be useful to replace the pipe with redirection to a file, and
> see what you get when invoking the command from Emacs and from a shell
> prompt outside Emacs.

Good point.  I tried that now (with "| cat > /tmp/" to get a pipe in
there), and the contents that were written to file were correct utf-8.

Mysterious.  Could the problem be in pbcopy -- that's assuming something
about the coding system when run from inside Emacs somehow?  That
doesn't sound very likely, but...

I've added Alan to the CCs; perhaps he has some insights here.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 08:14:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 03:14:10 2021
Received: from localhost ([127.0.0.1]:49070 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmAeP-00019G-PL
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 03:14:10 -0500
Received: from eggs.gnu.org ([209.51.188.92]:56932)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1mmAeO-000194-5O
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 03:14:09 -0500
Received: from [2001:470:142:3::e] (port=46998 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmAeI-0002Ez-GB; Sun, 14 Nov 2021 03:14:02 -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=Kf7v1hBIxzMOUeIii4wL/vdbNWdlwPvlbNdOzZY7QdQ=; b=F4FJacepwbA55S4zlCEw
 Q+fWHyg9lMAatrN7FqF1ksHOePe5qWRBD6+opVaQDxOWGq1+krpMm561zvspGphR5SQyIRhlbbp/Q
 fU269oF72CwEsk5s/6i1sDj4bMx9kYfkoXSGOlUmrMH12400l0ftvW3xRhIddZaTua+zGc77kHZFT
 2oGLL7c4SOnKhGhOyfRcSl/fho3P4vlAH5DO3dcsoEn+7X2KCnPeCR5yZNJmYD4d3ie+Ql2yWtbxk
 61hzVexlkIJsf/pYnYNArmnLnivApXK7gIN9Mzsr/jn+5pAE5Mfiu1YZto1xhKokq4HL2nxl5Iiil
 yTHiL4e0AqSnPA==;
Received: from [87.69.77.57] (port=4171 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mmAeG-0006mA-KF; Sun, 14 Nov 2021 03:14:00 -0500
Date: Sun, 14 Nov 2021 10:13:47 +0200
Message-Id: <83mtm7upc4.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
In-Reply-To: <87y25r8968.fsf@HIDDEN> (message from Lars Ingebrigtsen on Sun, 
 14 Nov 2021 08:53:51 +0100)
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
 <87y25r8968.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: tor.a.s.kringeland@HIDDEN, 51832 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Lars Ingebrigtsen <larsi@HIDDEN>
> Cc: Tor Kringeland <tor.a.s.kringeland@HIDDEN>,  51832 <at> debbugs.gnu.org
> Date: Sun, 14 Nov 2021 08:53:51 +0100
> 
> >>   (shell-command "echo -n '悟' | pbcopy")
> >> 
> >> or
> >> 
> >>   (shell-command "echo -n 'øøøø' | pbcopy")
> >> 
> >> fills the clipboard with `ÊÇü' and `√∏', respectively, while if I run
> >> the same commands in a terminal emulator outside Emacs I get back the
> >> original input.  The same happens if I run the same shell commands in
> >> `eshell'.  This happens when I run a recent build of Emacs 29 with `-Q'
> >> on macOS Catalina.
> >
> > Please be specific about the "recent build" part: which commit are you
> > using?
> 
> I'm seeing the same issue with the current tree on Macos.
> 
> > There were some problems with the clipboard that were recently fixed.
> 
> This doesn't involve Emacs' interactions with the clipboard, though --
> the pbcopy command is what's putting things on the clipboard.  But
> pbcopy's apparently misinterpreting the bytes it's getting over the pipe
> somehow, which is surprising, because I assumed shell-command just sent
> the entire string to a shell for execution.  (But I haven't read the
> code.)

It could be useful to replace the pipe with redirection to a file, and
see what you get when invoking the command from Emacs and from a shell
prompt outside Emacs.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 07:54:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 02:54:05 2021
Received: from localhost ([127.0.0.1]:49049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmAKy-0000ch-Rj
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 02:54:05 -0500
Received: from quimby.gnus.org ([95.216.78.240]:57844)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mmAKv-0000c7-Qt
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 02:54:02 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
 :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=hQKed/1qYG0ddxDU7OzPE5DTvMBGLWgqhn97VFEMCKM=; b=R9rJ6NZFVTYEhlClFqzbGzQG/C
 c7hP38aa6eKvcpRwyF/oMOPfBvgkQhk19lapthaJbK9sVV36mdTNKNKm0NiE0h6g62afwvHtn0iNz
 XybPpdpsS8zX1KyoNhLq9UThgyDfe++j/E6pnOWbi17iI9g/fwCuH/GHuBvxpkYKw57Q=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mmAKm-0001sn-51; Sun, 14 Nov 2021 08:53:55 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN> <834k8fw62v.fsf@HIDDEN>
X-Now-Playing: Schneider TM's _The 8 Of Space_: "Oh Life"
Date: Sun, 14 Nov 2021 08:53:51 +0100
In-Reply-To: <834k8fw62v.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 14 Nov
 2021 09:26:48 +0200")
Message-ID: <87y25r8968.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 
 Content preview:  Eli Zaretskii <eliz@HIDDEN> writes: >> Running >> >> (shell-command
    "echo -n '悟' | pbcopy") >> >> or >> >> (shell-command "echo -n 'øøøø'
    | pbcopy") >> >> fills the clipboard with `ÊÇü' and `√∏', respectively,
    while if I ru [...] 
 
 Content analysis details:   (-2.9 points, 5.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                             [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: Tor Kringeland <tor.a.s.kringeland@HIDDEN>, 51832 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Running
>>=20
>>   (shell-command "echo -n '=E6=82=9F' | pbcopy")
>>=20
>> or
>>=20
>>   (shell-command "echo -n '=C3=B8=C3=B8=C3=B8=C3=B8' | pbcopy")
>>=20
>> fills the clipboard with `=C3=8A=C3=87=C3=BC' and `=E2=88=9A=E2=88=8F', =
respectively, while if I run
>> the same commands in a terminal emulator outside Emacs I get back the
>> original input.  The same happens if I run the same shell commands in
>> `eshell'.  This happens when I run a recent build of Emacs 29 with `-Q'
>> on macOS Catalina.
>
> Please be specific about the "recent build" part: which commit are you
> using?

I'm seeing the same issue with the current tree on Macos.

> There were some problems with the clipboard that were recently fixed.

This doesn't involve Emacs' interactions with the clipboard, though --
the pbcopy command is what's putting things on the clipboard.  But
pbcopy's apparently misinterpreting the bytes it's getting over the pipe
somehow, which is surprising, because I assumed shell-command just sent
the entire string to a shell for execution.  (But I haven't read the
code.)

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at 51832 <at> debbugs.gnu.org:


Received: (at 51832) by debbugs.gnu.org; 14 Nov 2021 07:27:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 02:27:08 2021
Received: from localhost ([127.0.0.1]:49033 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mm9uu-0008KT-71
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 02:27:08 -0500
Received: from eggs.gnu.org ([209.51.188.92]:51218)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1mm9ut-0008K5-4P
 for 51832 <at> debbugs.gnu.org; Sun, 14 Nov 2021 02:27:07 -0500
Received: from [2001:470:142:3::e] (port=45632 helo=fencepost.gnu.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mm9un-0005CM-LE; Sun, 14 Nov 2021 02:27:01 -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=c2aSJuXuFXT0SghadsaZmP/HWT+Ej2+gWA8OYLcXgJc=; b=a0iyrKUL7fouFmVbg8lU
 TolsHXai+OFOAgvs8Y3khuuh/9osbs1DKOJ5rFHzUqivrvUnZH0v4YZpr68fzNHk4ts1iG12h4Bvg
 uo+q+mBnYUjpQC/bO5QEZ9Nj1hDTzjzrOFAt5OBnoWN/JBBk5qdG3/FvPCxqZGWOvaOBX6zJELbFZ
 2eWuRw1FkIuQkR0kuusm9OwQnvtshgeFcNGYSbbKgA2wSgZ8/djXyg5ION+FN8w4v+g+ei1kngZ7H
 rD6ZJfFRq62+osWLfJJxZZDM8WCDpuBc6OYo1jRm0SixvYL0mw2qpNYN+BK+aUzNlNG+0NHT6tidY
 Bq1abaEmMipnRg==;
Received: from [87.69.77.57] (port=1306 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mm9un-0002rM-8U; Sun, 14 Nov 2021 02:27:01 -0500
Date: Sun, 14 Nov 2021 09:26:48 +0200
Message-Id: <834k8fw62v.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Tor Kringeland <tor.a.s.kringeland@HIDDEN>
In-Reply-To: <m21r3jfn59.fsf@HIDDEN> (message from Tor Kringeland on Sun, 14
 Nov 2021 04:10:10 +0100)
Subject: Re: bug#51832: Piping unicode text in `shell-command'
References: <m21r3jfn59.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51832
Cc: 51832 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Tor Kringeland <tor.a.s.kringeland@HIDDEN>
> Date: Sun, 14 Nov 2021 04:10:10 +0100
> 
> Running
> 
>   (shell-command "echo -n '悟' | pbcopy")
> 
> or
> 
>   (shell-command "echo -n 'øøøø' | pbcopy")
> 
> fills the clipboard with `ÊÇü' and `√∏', respectively, while if I run
> the same commands in a terminal emulator outside Emacs I get back the
> original input.  The same happens if I run the same shell commands in
> `eshell'.  This happens when I run a recent build of Emacs 29 with `-Q'
> on macOS Catalina.

Please be specific about the "recent build" part: which commit are you
using?  There were some problems with the clipboard that were recently
fixed.

Also, do older versions of Emacs behave differently with that command?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Nov 2021 07:05:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 14 02:05:17 2021
Received: from localhost ([127.0.0.1]:48986 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mm9Zl-0005WL-Bs
	for submit <at> debbugs.gnu.org; Sun, 14 Nov 2021 02:05:17 -0500
Received: from lists.gnu.org ([209.51.188.17]:43944)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tor.a.s.kringeland@HIDDEN>) id 1mm5uT-0002gH-7M
 for submit <at> debbugs.gnu.org; Sat, 13 Nov 2021 22:10:26 -0500
Received: from eggs.gnu.org ([209.51.188.92]:53832)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tor.a.s.kringeland@HIDDEN>)
 id 1mm5uS-0005pB-Vb
 for bug-gnu-emacs@HIDDEN; Sat, 13 Nov 2021 22:10:24 -0500
Received: from mailgw101.it.ntnu.no ([129.241.56.177]:49234)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tor.a.s.kringeland@HIDDEN>)
 id 1mm5uQ-0002xm-AM
 for bug-gnu-emacs@HIDDEN; Sat, 13 Nov 2021 22:10:24 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntnu.no;
 i=@ntnu.no; q=dns/txt; s=s1-1909-ntnu; t=1636859411; h=from : to :
 subject : date : message-id : mime-version : content-type :
 content-transfer-encoding : from;
 bh=sw0l6FKdmj9IoBeWEftFuWNsY1WgpiCD1UX6H94h6Wo=;
 b=PooUtMzuYyr25iJOLPeKmezP1HtU6VJ8scAr4mc2c9xgpw5tcAsCpEm9VBKcmCy7gYUxv
 ofTwnYSjiEGmPTteZJv+MB1TWHYXttmbstw+YImRcGpuc9Glg9O8R2Ax7JgrVc1fvIe8WGh
 vuusI1sMIkmLrvJaDXWcZGyue0JFpiafyI4rPPvXU+byM72V3y8tgmvj0et+rHGvBkbSKNT
 E8zeEQnCAQ4OtUTQ8Ke1xIQQcQay+hB3jnszlyO3cCpmSQ6bWQLdlMxITPrNEcj8QGHZcz3
 mJlr2rw8K0UPVvzuzUC7jt+gBF7RMLCu8AU5x498EycmDLaBfnkSmOY0E4pw==
Received: from localhost (localhost [127.0.0.1])
 by mailgw101.it.ntnu.no (Postfix) with ESMTP id E55D71DE1F60
 for <bug-gnu-emacs@HIDDEN>; Sun, 14 Nov 2021 04:10:11 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mailgw101.it.ntnu.no
X-Spam-Flag: NO
X-Spam-Score: -4.59
X-Spam-Level: 
Received: from mailgw101.it.ntnu.no ([127.0.0.1])
 by localhost (mailgw101.it.ntnu.no [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id GDMoceCla7h9 for <bug-gnu-emacs@HIDDEN>;
 Sun, 14 Nov 2021 04:10:11 +0100 (CET)
Received: from localhost (unknown [37.120.203.82])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 (Authenticated sender: takringe@HIDDEN)
 by mailgw101.it.ntnu.no (Postfix) with ESMTPSA id 95A4D1DE26B8
 for <bug-gnu-emacs@HIDDEN>; Sun, 14 Nov 2021 04:10:11 +0100 (CET)
From: Tor Kringeland <tor.a.s.kringeland@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Piping unicode text in `shell-command'
Date: Sun, 14 Nov 2021 04:10:10 +0100
Message-ID: <m21r3jfn59.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=129.241.56.177;
 envelope-from=tor.a.s.kringeland@HIDDEN; helo=mailgw101.it.ntnu.no
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 14 Nov 2021 02:05:16 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

Running

  (shell-command "echo -n '=E6=82=9F' | pbcopy")

or

  (shell-command "echo -n '=C3=B8=C3=B8=C3=B8=C3=B8' | pbcopy")

fills the clipboard with `=C3=8A=C3=87=C3=BC' and `=E2=88=9A=E2=88=8F', res=
pectively, while if I run
the same commands in a terminal emulator outside Emacs I get back the
original input.  The same happens if I run the same shell commands in
`eshell'.  This happens when I run a recent build of Emacs 29 with `-Q'
on macOS Catalina.




Acknowledgement sent to Tor Kringeland <tor.a.s.kringeland@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#51832; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 14 Nov 2021 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.