comparison lisp/international/utf-8.el @ 56800:752ef76fcc08

(utf-8-post-read-conversion): If the buffer is unibyte, temporarily set it multibyte.
author Kenichi Handa <handa@m17n.org>
date Fri, 27 Aug 2004 00:24:50 +0000
parents 9274a15c1400
children c3945be39e09
comparison
equal deleted inserted replaced
56799:d2348e1fa995 56800:752ef76fcc08
868 (narrow-to-region (point) (+ (point) length)) 868 (narrow-to-region (point) (+ (point) length))
869 ;; Can't do eval-when-compile to insert a multibyte constant 869 ;; Can't do eval-when-compile to insert a multibyte constant
870 ;; version of the string in the loop, since it's always loaded as 870 ;; version of the string in the loop, since it's always loaded as
871 ;; unibyte from a byte-compiled file. 871 ;; unibyte from a byte-compiled file.
872 (let ((range (string-as-multibyte "^\xc0-\xc3\xe1-\xf7")) 872 (let ((range (string-as-multibyte "^\xc0-\xc3\xe1-\xf7"))
873 (buffer-multibyte enable-multibyte-characters)
873 hash-table ch) 874 hash-table ch)
875 (set-buffer-multibyte t)
874 (when utf-translate-cjk-mode 876 (when utf-translate-cjk-mode
875 (if (not utf-translate-cjk-lang-env) 877 (if (not utf-translate-cjk-lang-env)
876 ;; Check these characters: 878 ;; Check these characters:
877 ;; "U+2e80-U+33ff", "U+ff00-U+ffef" 879 ;; "U+2e80-U+33ff", "U+ff00-U+ffef"
878 ;; We may have to translate them to CJK charsets. 880 ;; We may have to translate them to CJK charsets.
891 (if (and hash-table 893 (if (and hash-table
892 (setq ch (gethash (encode-char ch 'ucs) hash-table))) 894 (setq ch (gethash (encode-char ch 'ucs) hash-table)))
893 (progn 895 (progn
894 (insert ch) 896 (insert ch)
895 (delete-char 1)) 897 (delete-char 1))
896 (forward-char 1))))) 898 (forward-char 1))))
899 (or buffer-multibyte
900 (set-buffer-multibyte nil)))
897 901
898 (when (and utf-8-compose-scripts (> length 1)) 902 (when (and utf-8-compose-scripts (> length 1))
899 ;; These currently have definitions which cover the relevant 903 ;; These currently have definitions which cover the relevant
900 ;; unicodes. We could avoid loading thai-util &c by checking 904 ;; unicodes. We could avoid loading thai-util &c by checking
901 ;; whether the region contains any characters with the appropriate 905 ;; whether the region contains any characters with the appropriate