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

Previous Next

Package: emacs;

Reported by: Tor Kringeland <tor.a.s.kringeland <at> ntnu.no>

Date: Sun, 14 Nov 2021 07:06:02 UTC

Severity: normal

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 51832 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: tor.a.s.kringeland <at> ntnu.no, 51832 <at> debbugs.gnu.org
Subject: Re: bug#51832: Piping unicode text in `shell-command'
Date: Sun, 14 Nov 2021 10:13:47 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Tor Kringeland <tor.a.s.kringeland <at> ntnu.no>,  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.




This bug report was last modified 2 years and 248 days ago.

Previous Next


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