[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master db828f6: Don't rely on defaults in decoding UTF

From: Stefan Monnier
Subject: Re: [Emacs-diffs] master db828f6: Don't rely on defaults in decoding UTF-8 encoded Lisp files
Date: Fri, 25 Sep 2015 08:21:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> E.g., try saving a foo.el with the following contents:
>   (setq string "א“”")
> using cp1255, then kill the buffer and visit it again.

AFAIK saving in this way requires very explicit action on the part of
the user.  She gets what she asked for.  But yes, we should probably
make it even harder (i.e. disallow it altogether as long as there's no
"coding:cp1255" tag).

> So we now agree that at least non-*.el files should have the coding
> cookie, yes?

Yes, definitely.

> Bottom line: we use prefer-utf-8 for *.el files so that the
> probability of such catastrophic errors be minimized when the lazy
> maintainers couldn't be bothered to add a cookie.

No.  I pushed for prefer-utf-8 because I want Elisp source code to be
declared to use utf-8 encoding.  I can imagine a future where we don't
even support Elisp files using another coding system (i.e. throw away the
load-with-code-conversion machinery).

> More generally, I think we should require any text file in the Emacs
> repository that includes non-ASCII characters to have an explicit
> coding cookie, so that these subtle problems don't lie low because
> most Emacs contributors live in UTF-8 locales.

My view OTOH is that the future is utf-8 only, and in that future we
won't want to have redundant "coding:utf-8" tags everywhere, so we need
to find ways to go from here (i.e. "need a coding: tag for any non-ASCII
file") to there.  I don't have an answer in general, but prefer-utf-8 is
a step in that direction, which can be used for some class of files
(e.g. Elisp).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]