emacs-devel
[Top][All Lists]
Advanced

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

Re: converting between charsets


From: Alexander Kotelnikov
Subject: Re: converting between charsets
Date: Mon, 08 May 2006 13:39:46 +0400
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

>>>>> On Sun, 07 May 2006 23:28:09 -0400
>>>>> "SM" == Stefan Monnier <address@hidden> wrote:
SM> 
>>>> 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.
SM> 
>> I am using Gnus, it does not have such functionality,
SM> 
SM> In what way does the functionality described in the node "Charsets" of the
SM> Gnus manual fail to provide the functionality you need?

It fails. Its default value contains element

("^\\(fido7\\|relcom\\)\\.[^,]*\\(,[    \n]*\\(fido7\\|relcom\\)\\.[^,]*\\)*$" 
koi8-r
  (koi8-r))

and my post to fido7 hierarchy go in utf-8 anyway.

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

Let's first talk about encoding regions. Why does not it work with
encode-coding-region?

What about garbage, if encoding/decoiding works I can always decode
into internal representation and encode into desired charset in
send-hook.

I would be happy to get an answer on question: "How do I decode and
encode in Emacs?"

SM> So one way to do it is to take care of the encoding yourself, which may
SM> amount to doing the whole "send" yourself (i.e. the NIH approach).
SM> Or the

NIH?

SM> other way is to figure out how to tell the code that already does the
SM> encoding to use koi8 rather than utf-8.

There is no such code right now, and, probably, I will write it. But
I'll need to make an encoding into koi8-r which does not seems to
work.

>> I have started emacs without ~/.emacs and evaluated 
>> (setq default-input-method "cyrillic-jcuken")
SM> 
SM> What's your locale?  What version of Emacs is this?
SM> 
>> What I got:
>> 1. Paste into Emacs frame works strange:
SM> 
SM> What text did you paste?  Where does it come from?

I type some Russian text in xterm and paste in into Emacs, have a look
at the attached screenshot.

Attachment: emacs_cyrillic_paste.png
Description: see the difference

SM> 
>> Cyrillic nput in emacs -nw in xterm still does not work, if I just
>> change X keyboard layout.
SM> 
SM> That doesn't give us much to go on, does it?  What does it do, other than
SM> "not work"?

It beeps.

-- 
Alexander Kotelnikov
Saint-Petersburg, Russia

reply via email to

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