Subject: bug#1654: 23.0.60; auto encoding detection
(detect-coding-region) not working



In article <87k56bu0uu.fsf@xxxxxxxxxxx>, Chong Yidong <cyd@xxxxxxxxxxxxxxxxx>
writes:

> Hi Handa-san,
> Could you take a look at bug#1654? Thanks.

> http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=1654

Ok, but I can't reproduce the problem for test_gbk.txt.
What is shown by C-h C RET?

Gaofeng Huang wrote:
> Important settings:
[...]
> value of $LC_CTYPE: zh_CN.UTF-8

So, I installed that locale, and ran Emacs under it. The
file test_gbk.txt was correctly detected as GBK.

But, as the byte sequence pattern of GBK and Big5 is not
distinguishable, it is impossible to make Emacs detect both
files correctly at the same time.

By the way, as the file test_big5.txt is completely the same
as test_gbk.txt, I changed the encoding of test_big5.txt to
Big5 by iconv, and tested with it.

> The auto encoding detection can not detect the correct encoding (for
> example, for the two files attached). And neither the
> detect-coding-region function works (after M-x find-file-literally)

At least detect_coding_region works correctly for
test_gbk.txt. But, it doesn't work for test_big5.txt by the
same reason as above.

If you want to read Big5 file correctly, do something like
this:
C-x C-m c big5 RET C-x C-f _FILENAME_
or change the language environment to Chinese-BIG5 by:
C-x C-m l Chinese-BIG5 RET
or run Emacs under Big5 locale.

---
Kenichi Handa
handa@xxxxxxxx




...



Privacy