[Top][All Lists]

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

Re: Cyrillic vs UTF-8

From: Kenichi Handa
Subject: Re: Cyrillic vs UTF-8
Date: Mon, 19 May 2003 11:31:50 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, "Stefan Monnier" <monnier+gnu/address@hidden> 
>>  I'd like to avoid introducing a new mechanism to control a
>>  coding system as far as possible.  And, the second
>>  preference-order (used for saving) works only in this case:
>>  (1) The buffer file coding system can't encode the current
>>      buffer, and
>>  (2) The most preferred coding system can encode the current
>>      buffer, and
>>  (3) A user doesn't want to use the most preferred one.
>>  Isn't it a very rare case?

> Maybe it is.  In my situation, I'd like utf-8 to be at the top
> of the preferences w.r.t decoding because it virtually never
> guesses wrong.
> OTOH, I'm still using a mostly-latin-1 environment, so I'd
> still rather avoid utf-8 when I can.  I.e. latin-1 should be at
> the top of my preferences w.r.t encoding.

In that case, I think the source of the problem is that the
command prefer-coding-system doesn't satisfy this request of
   Prefer utf-8 only in automatic detection on reading a
   file, not for the other situations.

(defun prefer-coding-system (coding-system)
  "Add CODING-SYSTEM at the front of the priority list for automatic detection.
This also sets the following coding systems:
  o coding system of a newly created buffer
  o default coding system for subprocess I/O
This also sets the following values:
  o default value used as `file-name-coding-system' for converting file names.
  o default value for the command `set-terminal-coding-system' (not on MSDOS)
  o default value for the command `set-keyboard-coding-system'

How about changing it to skip "This also ..." parts if
called with a prefix argument?

Then, on writing, if buffer-file-coding-system is not
locally bound, default-buffer-file-coding-system is tried

And, for the case that buffer-file-coding-system is locally
bound differently from default-buffer-file-coding-system,
but it can'd encode the current buffer, we can change
select-safe-coding-system to try
default-buffer-file-coding-system before trying the most
preferred coding system.

That way, I think we can satisfy your request completely.

Ken'ichi HANDA

reply via email to

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