unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bozhidar Batsov <bozhidar.batsov@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: schwab@suse.de, emacs-devel@gnu.org
Subject: Re: Using utf-8-auto as a process coding system
Date: Mon, 28 Jul 2014 18:05:50 +0300	[thread overview]
Message-ID: <etPan.53d666ce.1f16e9e8.6d75@Bozhidars-MacBook-Pro.local> (raw)
In-Reply-To: <83zjfxio9a.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2282 bytes --]

On July 25, 2014 at 4:03:58 PM, Eli Zaretskii (eliz@gnu.org) wrote:
> 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. 
The problem is Java, not cider. cider is an Emacs Lisp client for a Clojure REPL server (nREPL), which runs on top of the JVM. I seem to recall that Java doesn’t use UTF-8 at all, think it was using the older UTF-16.

I guess it’s compatible with UTF-8 to some extent.



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. 
Thanks for the suggestions. I’ll ask some of the Windows users to try them both and see what works and what doesn’t.



[-- Attachment #2: Type: text/html, Size: 5816 bytes --]

      reply	other threads:[~2014-07-28 15:05 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
2014-07-28 15:05           ` Bozhidar Batsov [this message]

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=etPan.53d666ce.1f16e9e8.6d75@Bozhidars-MacBook-Pro.local \
    --to=bozhidar.batsov@gmail.com \
    --cc=eliz@gnu.org \
    --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).