[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
replace-match converts 8-bit chars into multibyte
From: |
Katsumi Yamaoka |
Subject: |
replace-match converts 8-bit chars into multibyte |
Date: |
Fri, 19 Dec 2003 11:37:59 +0900 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
Hi,
I found a strange behavior that replace-match converts 8-bit
characters into multibyte string if the first argument contains
the "\\N" form and it runs in a multibyte buffer. Here is a
test case:
(let ((default-enable-multibyte-characters t)
from to)
(with-temp-buffer
(insert 128)
(setq from (buffer-string))
(goto-char (point-min))
(looking-at "\\(.+\\)")
(replace-match "\\1")
(setq to (buffer-string)))
(list 'from (append from nil) 'to (append to nil)))
=> (from (128) to (158 2208))
Such a conversion does not occur in Emacs 21.3. It is odd even
if the buffer's multibyteness is turned on, isn't it? It does
not occur when fiddling with a string as follows:
(let* ((string (string-as-multibyte (char-to-string 128)))
(from (copy-sequence string))
to)
(string-match "\\(.+\\)" string)
(setq to (replace-match "\\1" nil nil string))
(list 'from (append from nil) 'to (append to nil)))
=> (from (128) to (128))
This problem actually occurred, while processing a Japanese mail
message to be sent encoded by shift_jis (i.e., it contained
8-bit characters) in a SEMI MUA. Although most Japanese mails
are encoded into 7-bit characters, there are some characters
which cannot be expressed with 7-bit. Moreover, I think it is
natural to encode a Japanese message in a multibyte buffer.
Let me say repeatedly that there is no problem in Emacs 21.3.
Regards,
--
Katsumi Yamaoka <address@hidden>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- replace-match converts 8-bit chars into multibyte,
Katsumi Yamaoka <=