From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alexander Kotelnikov Newsgroups: gmane.emacs.devel Subject: converting between charsets Date: Sun, 07 May 2006 13:52:08 +0400 Organization: Global disintoxication Message-ID: <87lktejh6f.fsf@myxomop.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1146996329 3199 80.91.229.2 (7 May 2006 10:05:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 7 May 2006 10:05:29 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 07 12:05: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 1Fcg8e-00083G-AR for ged-emacs-devel@m.gmane.org; Sun, 07 May 2006 12:05:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fcg8d-00063l-SR for ged-emacs-devel@m.gmane.org; Sun, 07 May 2006 06:05:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fcg8Q-00061j-DS for emacs-devel@gnu.org; Sun, 07 May 2006 06:05:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fcg8P-00061V-RK for emacs-devel@gnu.org; Sun, 07 May 2006 06:05:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fcg8P-00061S-KR for emacs-devel@gnu.org; Sun, 07 May 2006 06:05:05 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Fcg8z-0002uC-MH for emacs-devel@gnu.org; Sun, 07 May 2006 06:05:41 -0400 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1Fcg8L-0007zP-VL for emacs-devel@gnu.org; Sun, 07 May 2006 12:05:01 +0200 Original-Received: from 81.211.124.120.adsl-spb.net.rol.ru ([81.211.124.120]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 07 May 2006 12:05:01 +0200 Original-Received: from sacha by 81.211.124.120.adsl-spb.net.rol.ru with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 07 May 2006 12:05:01 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-To: emacs-devel@gnu.org Original-Lines: 53 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 81.211.124.120.adsl-spb.net.rol.ru Mail-Copies-To: never User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:6r1ShvtiK9PPcTK3q1r9FXWYGoc= 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:54029 Archived-At: Hello. 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.] Theoretically something like (encode-coding-region (point-min) (point-max) 'koi8-r) should work, but it does not. There could be three different ways, which I checked, how characters to be converted can appear in emacs buffer: a. when I open such file. b. when I type in characters and my keyboard layout in X is different from 'us', for me it is normally 'ru' then. c. when I type in after I used toggle-input-method. And the trouble is that encode-coding-region converts only in case (c). In (a) and (b) characters that need conversion are substituted with question marks. And even in (c) conversion is performed (if, for instance, I save a file after it appears to be in koi8-r) in the converted buffer converted characters are shown in \321 manner. So, it will be nice to get some help on this, thanks. 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") BTW, there are other troubles with handling charters other that first half of ASCII table: 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. 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. Probably, somebody can comment on this also. Thanks once more, -- Alexander Kotelnikov Saint-Petersburg, Russia