< However, if your locale is Chinese or `prefer-coding-system' includes chinese-iso-8bit,
> However, if your locale is e.g. Chinese or `prefer-coding-system' includes chinese-iso-8bit,
Unicad is short for Universal Charset Auto Detector. It is an Emacs-Lisp port of Mozilla Universal Charset Detector.
Unicad project is hosted on Google Code: http://code.google.com/p/unicad/.
Unicad helps Emacs to guess the correct coding system when opening a file.
Will there be support for iso-8859-9 (latin-5, Turkish) encoding?
I haven’t considered Turkish. I would put it to TODO list. But I think latin-1, latin-2 and latin-5 are too similar to distinguish. It’ll be very hard. I hope someone can help. – Qichen
Download the latest unicad.el, copy it to your Emacs load path (e.g. site-lisp directory), and add the following line to your ~/.emacs:
You may byte compile this file to speed up the charset detecting process.
Emacs already comes with a heuristic to determine the encoding of files opened. This heuristic is influenced by the list of preferred coding systems, which in turn is determined by the locale (and users calling
‘prefer-coding-system’ in their init file).
However, if your locale is e.g. Chinese or
‘prefer-coding-system’ includes chinese-iso-8bit, and you open a source code written by a German, you’ll find Emacs has chosen the wrong coding system in most of cases. In this case, Mule is actually not for real Multilingual environment but for multiple single lingual environment.
On the other hand, Unicad can “guess” the coding system based on charset distribution tables provided by Mozilla Universal Charset Detector, that are sampled from many mega-byte text materials. The detection accuracy is well proven in Mozilla Firefox. Unicad.el is trying to bring this ability into Emacs for real multilingual users, especially who uses multibyte coding systems.