From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: TUTORIAL.bg and windows-1251 Date: Mon, 5 Jan 2004 13:14:39 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200401050414.NAA00014@etlken.m17n.org> References: <3FB52552.6090302@fmi.uni-sofia.bg> <200311170721.QAA11735@etlken.m17n.org> <3FBA3F81.4010602@fmi.uni-sofia.bg> <200311242355.IAA24563@etlken.m17n.org> <3FC45367.6070504@fmi.uni-sofia.bg> <200311260747.QAA27236@etlken.m17n.org> <3FC464C2.7010504@fmi.uni-sofia.bg> <200311261317.WAA27673@etlken.m17n.org> <200312030834.RAA03004@etlken.m17n.org> <3FCF60C9.8060009@fmi.uni-sofia.bg> <200312042328.IAA06933@etlken.m17n.org> <3FF2E5DF.4090906@fmi.uni-sofia.bg> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1073277592 3796 80.91.224.253 (5 Jan 2004 04:39:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 5 Jan 2004 04:39:52 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Jan 05 05:39:49 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AdMWr-0000gr-00 for ; Mon, 05 Jan 2004 05:39:49 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AdMWr-000251-00 for ; Mon, 05 Jan 2004 05:39:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AdNLs-0004o9-D8 for emacs-devel@quimby.gnus.org; Mon, 05 Jan 2004 00:32:32 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AdNGW-0002p6-LT for emacs-devel@gnu.org; Mon, 05 Jan 2004 00:27:00 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AdNEG-0001Ni-73 for emacs-devel@gnu.org; Mon, 05 Jan 2004 00:25:11 -0500 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AdNDc-0000qF-Lz for emacs-devel@gnu.org; Mon, 05 Jan 2004 00:24:01 -0500 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2]) by tsukuba.m17n.org (8.11.6p2/3.7W-20010518204228) with ESMTP id i054Eeh29665; Mon, 5 Jan 2004 13:14:40 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) by fs.m17n.org (8.11.6/3.7W-20010823150639) with ESMTP id i054Eds03243; Mon, 5 Jan 2004 13:14:39 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id NAA00014; Mon, 5 Jan 2004 13:14:39 +0900 (JST) Original-To: ogi@fmi.uni-sofia.bg In-reply-to: <3FF2E5DF.4090906@fmi.uni-sofia.bg> (message from Ognyan Kulev on Wed, 31 Dec 2003 17:06:07 +0200) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:19010 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19010 In article <3FF2E5DF.4090906@fmi.uni-sofia.bg>, Ognyan Kulev writes: > Today (2003-12-31) I've checked out emacs and tested it again. > Unfortunately, it doesn't work as expected -- microsoft-cp1251 font > encoding is not used. > ctext-non-standard-encodings-alist contains microsoft-cp1251. Could you try this code? (let ((lang-env current-language-environment) (mirror-R (string (decode-char 'ucs #x42f))) (hex-print #'(lambda (head str) (insert head) (dotimes (i (length str)) (let ((ch (aref str i))) (if (< ch 128) (insert ch) (insert (format "\\x%X" (aref str i)))))) (insert "\n"))) encoded decoded) (funcall hex-print "original:" mirror-R) (set-language-environment "Bulgarian") (setq encoded (encode-coding-string mirror-R 'ctext-with-extensions)) (funcall hex-print "encoded: " encoded) (setq decoded (decode-coding-string encoded 'ctext-with-extensions)) (funcall hex-print "decoded: " decoded) (set-language-environment "English") (setq encoded (encode-coding-string mirror-R 'ctext-with-extensions)) (funcall hex-print "encoded: " encoded) (setq decoded (decode-coding-string encoded 'ctext-with-extensions)) (funcall hex-print "decoded: " decoded) (set-language-environment lang-env)) The result I got is this. original:\x5144F encoded: %/1\x80\x92microsoft-cp1251\xDF decoded: \x5144F encoded: %G\xD0\xAF%@ decoded: \x5144F It seems that the coding system ctext-with-extensions is working as expected here. > I tried to understand the code, but without great success. So > ctext-pre-write-conversion seems the only place that uses > ctext-non-standard-encodings property of current language environment > (via ctext-non-standard-encodings-table). Yes. > Do I understand it right that > somehow all rendering of text to X is done via the "special" compound > text (ctext) coding system, while buffer can be in other coding system? > If not, how this ctext coding system is used, and, consequently, > ctext-non-standard-encodings property? (I just try to help getting > this thing working.) Rendering is not relevant to the current problem. When Emacs accepts a selection request, it encodes the currently selected text by a coding-system bound to selection-coding-system. By default, ctext-with-extensions (alias of compound-text-with-extensions) is bound. And, `pre-write-conversion' property of ctext-with-extensions is ctext-pre-write-conversion. So, this function is called before the actual encoding is done. By the way, for rendering, I installed the code I proposed a while ago which forces *-microsoft-cp1251 fonts to be used for Cyrillic letters of the charset mule-unicode-0100-24ff in Bulgarian environment on 2003-12-29. Have you noticed it? --- Ken'ichi HANDA handa@m17n.org