From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: converting between charsets Date: Sun, 07 May 2006 23:28:09 -0400 Message-ID: <87d5ep1a2c.fsf-monnier+emacs@gnu.org> References: <87lktejh6f.fsf@myxomop.com> <87u082109z.fsf-monnier+emacs@gnu.org> <84veshaajc.fsf@vinci.loc> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1147058911 25021 80.91.229.2 (8 May 2006 03:28:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 May 2006 03:28:31 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 08 05:28:27 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FcwQ6-0004lY-KT for ged-emacs-devel@m.gmane.org; Mon, 08 May 2006 05:28:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FcwQ6-00014z-4S for ged-emacs-devel@m.gmane.org; Sun, 07 May 2006 23:28:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FcwPt-00014t-Pj for emacs-devel@gnu.org; Sun, 07 May 2006 23:28:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FcwPr-00014h-B8 for emacs-devel@gnu.org; Sun, 07 May 2006 23:28:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FcwPr-00014e-6D for emacs-devel@gnu.org; Sun, 07 May 2006 23:28:11 -0400 Original-Received: from [209.226.175.4] (helo=tomts16-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FcwQb-00025g-If for emacs-devel@gnu.org; Sun, 07 May 2006 23:28:57 -0400 Original-Received: from alfajor ([70.55.147.184]) by tomts16-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20060508032810.UZFM27612.tomts16-srv.bellnexxia.net@alfajor>; Sun, 7 May 2006 23:28:10 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id B7D2BD82FC; Sun, 7 May 2006 23:28:09 -0400 (EDT) Original-To: emacs-devel@gnu.org In-Reply-To: <84veshaajc.fsf@vinci.loc> (Alexander Kotelnikov's message of "Sun, 07 May 2006 23:40:23 +0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:54054 Archived-At: >>> 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