help-gnu-emacs
[Top][All Lists]
Advanced

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

auto-recognize utf-8 encoded files upon visiting: solved (sort of...)


From: Gerald Wildgruber
Subject: auto-recognize utf-8 encoded files upon visiting: solved (sort of...)
Date: 24 Sep 2002 13:45:22 +0200
User-agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.3.50

Thanks to everybody who helped answering my question!

What I was trying to do was to make emacs auto-recognize utf-8 encoded
files upon visiting. In the beginning, it didn't.

The problem seems to have been that -- latin-9 being my primary language
environment -- utf-8 only appeared at the end of my priority list for
encodings. Emacs then seems to take my utf-8 file as beeing encoded in one
of the prior coding entries of the priority list (probably as one of the
iso-2022 family). Seems to be an erroneous recognition. Letters beyond
ascii are messed up then.

I didn't want utf-8 to be on the first place of the priority list (because
then all newly cereated files then have it as their default encoding), but
neither on the last one.

If you do a double M-x prefer-coding-system, the first time with utf-8,
the second time with latin-9 as the value, utf is promoted to the second
place of the priority list, latin-9 remains on the first place.

Now without any explicit indication of the encoding (e.g. via file
variables) emacs correctly recognizes the encoding, when I'm visiting
utf-8 files.

To achieve this entry order in the priority list PERMANENTLY I simply put
the following two lines, in this order, into my init file:

(prefer-coding-system 'utf-8)
(prefer-coding-system 'latin-9)

I'm sure there is a cleaner and more elegant solution, but it kind of works.

Last remark:

Charles, thanks for your hint on TEI; I gave TEI a long try many years ago,
when SGML came up, they provided very good introductory material to the
whole issue. But I didn't know of their work on emacs. You say that the
unicode stuff didn't work right on emacs 21.2. I compiled an emacs version
from the CVS sources (http://savannah.gnu.org/projects/emacs/) and there
unicode integration seems to be already more evolved than in the official
distribution. Almost everything works very well. Perhaps you should give it
a try. I'm also working with different languages (cl.greek) and I am very
happy with the evolving unicode capabilities of emacs. I think unicode
integration is THE way by which emacs stops being merely a tool for
programmers and addresses a wider audience also in the humanities.

Gerald.


reply via email to

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