emacs-devel
[Top][All Lists]
Advanced

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

Re: converting between charsets


From: Stefan Monnier
Subject: Re: converting between charsets
Date: Sun, 07 May 2006 08:43:56 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> After I switched to utf-8 as my basic environment encoding (on Linux)
> I got need of converting some texts sometimes back to koi8-r.  Typical
> task here is to convert outgoing mail to persons and newsgroups
> hierarchies which do not understand multibyte encodings.]

Emacs always converts from/to the encoding you use.  So you don't really
need to "convert from utf-8 to koi8", when sending email because, before the
email is sent, it's not any more in utf-8 than in any other encoding (other
than the internal encoding).
I.e. all you need is to tell Emacs that when sending to newsgroups such and
such, it should use koi8 rather than utf-8.  How to do that depends on the
newsreader you're using.

> Theoretically something like
> (encode-coding-region (point-min) (point-max) 'koi8-r)
> should work, but it does not.

I don't think that's true in theory.

> Relevant lines in my ~/.emacs are:

> (set-language-environment "UTF-8")
> (set-terminal-coding-system 'utf-8)
> (set-selection-coding-system 'utf-8)
> (setq default-buffer-file-coding-system 'utf-8)
> (set-input-mode (car (current-input-mode)) (nth 1 (current-input-mode)) 0)
> (setq default-input-method "cyrillic-jcuken")

Looks like you have some problems here.  Try to remove most of the lines
(if your locale is using utf-8 already, you really don't need to do
anything at all in your .emacs).
At the very least try removing the set-selection-coding-system and
set-input-mode.

> 1. Paste in X (from non-Emacs to Emacs) does not work correctly. It
> seems to be broken in different ways for singlebyte and mutlibyte.

Probably caused by your set-selection-coding-system.

> 2. With my utf-8 setup non-ascii input does not work on terminal (for
> example, when emacs is run in xterm as emacs -nw) when I switch input
> with system means (X keyboard layout, console input mode), instead of
> toggle-input-method.

Could be because of your set-input-mode.


        Stefan




reply via email to

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