From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: BOM (byte order mark) in process stdout and stderr Date: Thu, 25 Jun 2015 22:37:44 +0300 Message-ID: <834mlvefzr.fsf@gnu.org> References: <83616belyx.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1435261088 2591 80.91.229.3 (25 Jun 2015 19:38:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Jun 2015 19:38:08 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?utf-8?Q?J=C3=BCrgen_H=C3=B6tzel?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 25 21:38:01 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z8CyG-0006rj-Hb for ged-emacs-devel@m.gmane.org; Thu, 25 Jun 2015 21:38:00 +0200 Original-Received: from localhost ([::1]:57219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8CyF-0003pa-Pi for ged-emacs-devel@m.gmane.org; Thu, 25 Jun 2015 15:37:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8CyC-0003od-9j for emacs-devel@gnu.org; Thu, 25 Jun 2015 15:37:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8Cy9-0005OF-3C for emacs-devel@gnu.org; Thu, 25 Jun 2015 15:37:56 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:38973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Cy8-0005Nz-Qu for emacs-devel@gnu.org; Thu, 25 Jun 2015 15:37:53 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NQI00C00M6FAB00@mtaout27.012.net.il> for emacs-devel@gnu.org; Thu, 25 Jun 2015 22:33:53 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NQI00AYUMCH2A20@mtaout27.012.net.il>; Thu, 25 Jun 2015 22:33:53 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.183 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:187531 Archived-At: > From: J=C3=BCrgen H=C3=B6tzel > Date: Thu, 25 Jun 2015 20:37:41 +0200 > Cc: emacs-devel@gnu.org >=20 > > (let ((default-process-coding-system '(utf-8-with-signature . > > utf-8-with-signature))) > > (start-file-process > > "BOM" > > (generate-new-buffer "*bom-test*") > > "~/tmp/Hello.exe")) > > > > This results in the following process-buffer (hexl-mode): > > > > 00000000: efbb bf53 5444 4f55 540a 5354 4445 5252 ...STDOUT.S= TDERR > > 00000010: 0a0a 5072 6f63 6573 7320 424f 4d20 6669 ..Process B= OM fi > > 00000020: 6e69 7368 6564 0a nished. > > > > The stdout BOM was correctly removed but the stderr BOM is st= ill present. > > > > According to > > > http://www.gnu.org/software/emacs/manual/html_node/elisp/Output= -from-Processes.html > =20 > > > > there is now way to handle stderr separately. I made this wor= karound for > the > > Emacs fsharp-mode: > > > > > https://github.com/juergenhoetzel/fsharpbinding/commit/d0d3600c= 38d0e9f47a621583d0fc82685feda196 > =20 > > > > Are there any better solutions? > =20 > You didn't tell what version of Emacs do you want this to be so= lved. > =20 >=20 > GNU Emacs 24.5.1 Then I think you will have to remove the second BOM in your application's Lisp code. start-file-process redirects both standard output and standard error to the same file descriptor, and Emacs read= s their mix from that file descriptor. It will remove 1 BOM, but the other will be left alone. Alternatively, separate the standard output and standard error via shell redirection, and then read one of them separately from a file.