unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Questions on charset encoding detection and keyboard layout
Date: Fri, 11 Dec 2009 22:54:04 +0200	[thread overview]
Message-ID: <833a3h8c5v.fsf@gnu.org> (raw)
In-Reply-To: <4B22A2D6.9080302@gmail.com>

> Date: Sat, 12 Dec 2009 03:51:50 +0800
> From: "Hou, Ruoyu" <phoenixhou@gmail.com>
> 
> Before switching to Emacs I've been using EmEditor, a proprietary editor 
> under Windows. It could auto-detect those files with different encodings 
> and prompt a coding list in statistical confidence order for me to 
> determine the most likely file encoding. So I guess it may implements 
> certain statistical algorithm to detect the proper encoding.

This feature still awaits a volunteer to be added to Emacs.  It
shouldn't be too hard, I think.

> A friend of mine, a Vim user, showed me handling those different 
> encodings by ":set fencs=(a list of possible encodings, the point is to 
> put euc-jp before gbk)".

The customization I suggested, i.e.

  (prefer-coding-system 'euc-jp)

was supposed to make euc-jp of higher priority than GBK (and
everything else).  However, I understand it did you more harm than
good.

For more fine-grain control, try calling set-coding-system-priority
for every encoding you need to deal with, and in such an order that
the resulting list returned by coding-system-priority-list would show
the encodings in the order you want them.  (These two functions are
documented in the ELisp manual.)  I'm not sure this will have the same
effect as ":set fencs" in vim, though.

> The classification for document 
> storage is a good idea and habit, only if I had the foresight. It's a 
> bit unrealistic when facing a large quantity of unsorted documents in 
> different encodings already on the disk and constantly increasing (as I 
> always complain, why can't those guys just use UTF-8?). Is it possible 
> to for example write a script to distinguish and sort those documents?

I would try to find a program that could print a file's
encoding. `file' does not do that, but maybe there's something else
out there.




      reply	other threads:[~2009-12-11 20:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-10 14:42 Questions on charset encoding detection and keyboard layout Hou, Ruoyu
2009-12-10 19:03 ` Eli Zaretskii
2009-12-11  5:42   ` Hou, Ruoyu
2009-12-11  8:42     ` Eli Zaretskii
2009-12-11 15:18       ` Kevin Rodgers
2009-12-11 19:51       ` Hou, Ruoyu
2009-12-11 20:54         ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=833a3h8c5v.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).