>>>>> On Sun, 07 May 2006 23:28:09 -0400 >>>>> "SM" == Stefan Monnier 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.