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

> I am using Gnus, it does not have such functionality,

In what way does the functionality described in the node "Charsets" of the
Gnus manual fail to provide the functionality you need?

>>> Theoretically something like
>>> (encode-coding-region (point-min) (point-max) 'koi8-r)
>>> should work, but it does not.
SM> I don't think that's true in theory.
> Why?

Because it completely depends on how and when you do it.  There already is
an encoding step taking place somewhere.  So if you only add a call to
encode-coding-region somewhere you'll simply cause a double encoding to
happen which will most likely give you garbage.

So one way to do it is to take care of the encoding yourself, which may
amount to doing the whole "send" yourself (i.e. the NIH approach).  Or the
other way is to figure out how to tell the code that already does the
encoding to use koi8 rather than utf-8.

> I have started emacs without ~/.emacs and evaluated 
> (setq default-input-method "cyrillic-jcuken")

What's your locale?  What version of Emacs is this?

> What I got:
> 1. Paste into Emacs frame works strange:

What text did you paste?  Where does it come from?

> Cyrillic nput in emacs -nw in xterm still does not work, if I just
> change X keyboard layout.

That doesn't give us much to go on, does it?  What does it do, other than
"not work"?


        Stefan




reply via email to

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