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

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

How to make emacs auto-recognize utf-8 encoded files upon visiting


From: Gerald Wildgruber
Subject: How to make emacs auto-recognize utf-8 encoded files upon visiting
Date: 23 Sep 2002 18:39:19 +0200
User-agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.3.50

Hello,

I'm trying to make my emacs (GNU Emacs 21.3.50.1 on linux) auto-recognize
the right encoding when visiting files with utf-8 encoding. The emacs info
help entry says on the topic:

"Some coding systems can be recognized or distinguished by which byte
sequences appear in the data. However, there are coding systems that cannot
be distinguished, not even potentially."

Does this also apply to utf-8 encoded files? Is it impossible for emacs to
auto-recognize them (as for example the `file' command on the shell does)?

I'm aware of how to do this with File Variables (either by using the
`-*-...-*-' construct or a local variables list at the end of the file).
Both of them work well. Setting `(prefer-coding-system 'utf-8)' in `.emacs'
also works, but is kind of intrusive as all new files are then using this
encoding by default.

Even without file variables, Emacs does correctly recognize the encoding
when visiting latin-1 or latin-9 encoded files. Yet it fails when visiting
utf-8 encoded files. I get the `-:--' abbrev on the encoding part of the
modeline, and letters beyond ascii are messed up.

Can anyone give me a hint on how to make emacs find the correct coding
system (without setting it explicitly through file variables)?

Thanks,

Gerald.


reply via email to

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