[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Understanding how to specify UTF-8
From: |
Jason Rumney |
Subject: |
Re: Understanding how to specify UTF-8 |
Date: |
Fri, 21 Apr 2017 02:28:45 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Saturday, 8 April 2017 07:43:58 UTC+8, Will Parsons wrote:
> I want to always use Unicode/UTF-8 unless otherwise specified. I've noticed
> that I've attempted to do this in my .emacs file in two separate ways on two
> separate platforms:
>
> 1) (setq-default buffer-file-coding-system 'utf-8-unix)
>
> 2) (set-language-environment "UTF-8")
>
> Both seem to work, but I'm wondering if there are subtle differences between
> the two that I should be aware of.
The first only sets the default coding system for Files.
The second sets it for for everything, including system clipboard, file names,
process I/O ...
On modern GNU/Linux, Mac or other Posix based OS's, you probably want
everything in UTF-8, so the latter is correct.
On Windows, the system itself does not support UTF-8 fully, so the former is
safer. For clipboard and file names on Windows, the latest versions of Emacs
will use Unicode regardless of what you specify for the coding system, it is
really only process I/O that is the problem - Cygwin and Mingw apps may support
UTF-8 I/O, but native Windows apps (including the cmd.exe shell) can have
severe difficulties with it.