emacs-devel
[Top][All Lists]
Advanced

[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: Eli Zaretskii
Subject: Re: [Emacs-diffs] master db828f6: Don't rely on defaults in decoding UTF-8 encoded Lisp files
Date: Fri, 25 Sep 2015 10:55:24 +0300

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden
> Date: Thu, 24 Sep 2015 17:29:38 -0400
> 
> >   emacs -Q
> >   M-x set-locale-environment RET he_IL.ISO-8859-8 RET
> >   C-x C-f doc/lispref/tips.texi RET
> 
> Hmm.... I don't think this is using prefer-utf-8.  `prefer-utf-8' is
> used for *.el files via file-coding-system-alist.

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

As for *.el files: prefer-utf-8 is too easily duped for us to have
such infinite faith in it.  I can easily force a .el file to be saved
in non-UTF-8 encoding, and then it will be decoded incorrectly when
visited, if it doesn't have a coding cookie.  E.g., try saving a
foo.el with the following contents:

  (setq string "א“”")

using cp1255, then kill the buffer and visit it again.  You will see
this instead:

  (setq string "Ӕ")

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.  But we don't want
to be lazy ourselves, with the files we own and control.

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.




reply via email to

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