unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Cc: schwab@suse.de, emacs-devel@gnu.org
Subject: Re: Using utf-8-auto as a process coding system
Date: Fri, 25 Jul 2014 16:03:45 +0300	[thread overview]
Message-ID: <83zjfxio9a.fsf@gnu.org> (raw)
In-Reply-To: <etPan.53cdfce9.643c9869.3e7d@bozhidar-mini.local>

> Date: Tue, 22 Jul 2014 08:55:53 +0300
> From: Bozhidar Batsov <bozhidar.batsov@gmail.com>
> Cc: schwab@suse.de, emacs-devel@gnu.org
> 
> Ops, I actually used an incorrect link. That’s the proper one - https://github.com/clojure-emacs/cider/issues/532

OK, but that one is very short ;-)

> The gist of my problem is that Windows users have encoding related problems running cider (discussion here https://github.com/clojure-emacs/cider/issues/474).

There's a lot of confusion in that discussion.

> I guess the problem stems from this bit of code: 
> 
> (set-process-coding-system process 'utf-8-unix 'utf-8-unix)

'-auto' is not about end-of-line (EOL) format, it is about the Byte
Order Mark BOM (http://en.wikipedia.org/wiki/Byte_order_mark).

Does Cider on Windows indeed output UTF-8 encoded text preceded by a
BOM?  I'd be surprised, as the BOM is normally not needed with UTF-8.
In which case all this -auto thing just comes from another confused
user.

If there's no BOM, the first thing I'd try on Windows is this:

 (set-process-coding-system process 'utf-8-dos 'utf-8-unix)

This is because Windows programs will normally accept Unix EOL format
on input, but will usually output Windows CR-LF EOL, which Emacs needs
to decode into a single newline character.

A more elegant solution, which should be platform-independent, is to
use something like below (untested)

  (set-process-coding-system process
  			     (cons (coding-system-change-text-conversion
			            (car default-process-coding-system)
			            'utf-8)
				   (coding-system-change-text-conversion
				    (cdr default-process-coding-system)
                                    'utf-8)))

This has the advantage that it uses the wisdom already invested in
setting the defaults for each platform.




  reply	other threads:[~2014-07-25 13:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 13:15 Using utf-8-auto as a process coding system Bozhidar Batsov
2014-07-21 13:25 ` Andreas Schwab
2014-07-21 14:54   ` Bozhidar Batsov
2014-07-21 15:36     ` Eli Zaretskii
2014-07-22  5:55       ` Bozhidar Batsov
2014-07-25 13:03         ` Eli Zaretskii [this message]
2014-07-28 15:05           ` Bozhidar Batsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83zjfxio9a.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=bozhidar.batsov@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).