logo       

Re: non-ASCII characters in Automake source files: msg#00037

sysutils.automake.bugs

Subject: Re: non-ASCII characters in Automake source files

Paul Eggert writes:
> > Hey Emacs! -*- coding: utf-8 -*-
>
> I was hoping that
> Emacs could detect whether such files are UTF-8 or Latin-1 ...
> ...
> > (modify-coding-system-alist 'file "\\.\\(d\\|lisp\\)\\'" 'utf-8)
>
> Wouldn't this cause Emacs to use UTF-8 for each source file, even
> files that are Latin-1?

Any program opening a text file can easily distinguish an UTF-8 file
from a Latin-1 file. The heuristic is as follows: If it's well-formed
UTF-8 (according to the constraint on first byte and continuation
bytes), then assume it's an UTF-8 file, otherwise assume it's UTF-8.
This heuristic is 100% good for UTF-8 encoded files, and 99.99% good
for Latin-1 files. (There are very very few Latin-1 files which would
be mistakenly considered UTF-8 this way.)

> I briefly looked through the GNU Emacs 21.3 manual and read the
> source, and noticed that appending "(prefer-coding-system 'utf8)" to
> my ~/.emacs seemed to be pretty close to what I was looking for. You
> didn't mention this option

Good. I simply didn't know about it.

Bruno


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise