unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Re: TUTORIAL.bg and windows-1251
Date: Mon, 5 Jan 2004 13:14:39 +0900 (JST)	[thread overview]
Message-ID: <200401050414.NAA00014@etlken.m17n.org> (raw)
In-Reply-To: <3FF2E5DF.4090906@fmi.uni-sofia.bg> (message from Ognyan Kulev on Wed, 31 Dec 2003 17:06:07 +0200)

In article <3FF2E5DF.4090906@fmi.uni-sofia.bg>, Ognyan Kulev <ogi@fmi.uni-sofia.bg> 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\x02\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

  parent reply	other threads:[~2004-01-05  4:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-14 18:56 TUTORIAL.bg and windows-1251 Ognyan Kulev
2003-11-15 12:19 ` Ognyan Kulev
2003-11-26  7:33   ` Ognyan Kulev
2003-11-15 14:24 ` Jason Rumney
2003-11-17  7:21 ` Kenichi Handa
2003-11-18 15:49   ` Ognyan Kulev
2003-11-24 23:55     ` Kenichi Handa
2003-11-26  7:16       ` Ognyan Kulev
2003-11-26  7:47         ` Kenichi Handa
2003-11-26  8:30           ` Ognyan Kulev
2003-11-26 13:17             ` Kenichi Handa
2003-11-26 14:08               ` Ognyan Kulev
2003-12-03  8:34               ` Kenichi Handa
2003-12-04 16:28                 ` Ognyan Kulev
2003-12-04 23:28                   ` Kenichi Handa
2003-12-31 15:06                     ` Ognyan Kulev
2003-12-31 15:54                       ` Eli Zaretskii
2004-01-05  4:20                         ` Kenichi Handa
2004-01-05  4:14                       ` Kenichi Handa [this message]
2004-01-06 12:03                         ` YAMAMOTO Mitsuharu
2004-01-07  0:25                           ` Kenichi Handa
2004-01-07  1:32                             ` YAMAMOTO Mitsuharu
2004-01-07 16:22                         ` Ognyan Kulev
2004-01-07 23:58                           ` Kenichi Handa
2004-01-09 16:10                             ` Ognyan Kulev
2004-01-13  4:07                               ` Kenichi Handa
2004-01-14 11:42                                 ` Ognyan Kulev
2004-01-14 12:10                                   ` Kenichi Handa
2004-01-17 19:31                                     ` Ognyan Kulev
2004-01-19  0:34                                       ` Kenichi Handa
2004-01-21  6:45                                         ` Ognyan Kulev
2004-01-21 10:52                                           ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200401050414.NAA00014@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).