emacs-devel
[Top][All Lists]
Advanced

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

Re: can not decode 0x93 and 0x94 to correct char


From: William Xue
Subject: Re: can not decode 0x93 and 0x94 to correct char
Date: Sat, 29 Sep 2007 23:30:32 +0800
User-agent: Opera Mail/9.50 (Win32)

On Sat, 29 Sep 2007 21:47:37 +0800, Stefan Monnier <address@hidden> wrote:

; for cp1258
(prefer-coding-system 'windows-1258)
; for displaying utf-8 encoded file
(prefer-coding-system 'utf-8-emacs)
; for displaying chinese characters
(prefer-coding-system 'gb2312)

It would be a little problem. Because if I changed the gb2312 to gb18030
or gbk, the first setting (prefer-coding-system 'windows-1258) would
be failed.

I'm not sure what you mean by "would be failed", but when you use

If I changed the gb2312 to gb18030 or gbk, the char \223 and \224, which are
left and right quotation marks in cp1258, would not be decoded correctly.

So I think it may not be a correct solution for this situation. If somebody want to
decode Japanese, French, Russian, and so on, it's too complex

prefer-coding-system, you have to realize that it's not quite as simple as
it sounds:
- first, the three statements above mean to try (in this order) first
  gb2312, then utf-8, then windows-1258.
- second, this order should not be chosen exclusively based on how often
  you expect to use each of those encodings.  Because it depends a lot of
  the frequency of false positives.  E.g. utf-8 should usually be first,
because it has very few false positives (if the auto-detect decides it's
  utf-8, then it's very unlikely that the file isn't utf-8).
  OTOH window-1258 should *not* be first because it has many false
positives: any file without a 0 byte in it is a valid windows-1258 file.

The second point is the main reason why the order of detection of coding
systems when reading a file should be the same as the order of preference to
choose a coding system to use when writing a file.

Thanks!



        Stefan


_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel



--
Yours,
WilliamX




reply via email to

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