From 54923b8624385950198accb5baa6d81cba875ba3 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 1 Oct 2002 06:35:48 +0000 Subject: [PATCH] (encode-char): Pay attention to utf-translation-table-for-encode. --- lisp/international/mule.el | 40 +++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 632683fbb24..ebed8db2e0d 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -330,7 +330,9 @@ and CODE-POINT to a character. Currently not supported and just ignored." "Return code-point in coded character set CCS that corresponds to CHAR. Return nil if CHAR is not included in CCS. Currently the only supported coded character set is `ucs' (ISO/IEC -10646: Universal Multi-Octet Coded Character Set). +10646: Universal Multi-Octet Coded Character Set), and CHAR is first +translated through the translation-table named +`utf-translation-table-for-encode'. CHAR should be in one of these charsets: ascii, latin-iso8859-1, mule-unicode-0100-24ff, mule-unicode-2500-33ff, @@ -342,21 +344,27 @@ code-point in CCS. Currently not supported and just ignored." (let* ((split (split-char char)) (charset (car split))) (cond ((eq ccs 'ucs) - (cond ((eq charset 'ascii) - char) - ((eq charset 'latin-iso8859-1) - (+ (nth 1 split) 128)) - ((eq charset 'mule-unicode-0100-24ff) - (+ #x0100 (+ (* (- (nth 1 split) 32) 96) - (- (nth 2 split) 32)))) - ((eq charset 'mule-unicode-2500-33ff) - (+ #x2500 (+ (* (- (nth 1 split) 32) 96) - (- (nth 2 split) 32)))) - ((eq charset 'mule-unicode-e000-ffff) - (+ #xe000 (+ (* (- (nth 1 split) 32) 96) - (- (nth 2 split) 32)))) - ((eq charset 'eight-bit-control) - char)))))) + (let* ((table (get 'utf-translation-table-for-encode + 'translation-table)) + (trans (aref table char))) + (if trans + (setq split (split-char trans) + charset (car split))) + (cond ((eq charset 'ascii) + char) + ((eq charset 'latin-iso8859-1) + (+ (nth 1 split) 128)) + ((eq charset 'mule-unicode-0100-24ff) + (+ #x0100 (+ (* (- (nth 1 split) 32) 96) + (- (nth 2 split) 32)))) + ((eq charset 'mule-unicode-2500-33ff) + (+ #x2500 (+ (* (- (nth 1 split) 32) 96) + (- (nth 2 split) 32)))) + ((eq charset 'mule-unicode-e000-ffff) + (+ #xe000 (+ (* (- (nth 1 split) 32) 96) + (- (nth 2 split) 32)))) + ((eq charset 'eight-bit-control) + char))))))) ;; Coding system stuff -- 2.39.2