emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Unicode-2] `read' always returns multibyte symbol


From: Katsumi Yamaoka
Subject: Re: [Unicode-2] `read' always returns multibyte symbol
Date: Thu, 15 Nov 2007 12:01:04 +0900
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux)

>>>>> Stefan Monnier wrote:

> Don't know about gnus-work-buffer, but nntp-server-buffer should only
> ever contain unibyte data AFAICT, so it would be better to put it in
> unibyte mode.

I think it's better, too.  However, there might be a code that
copies data from nntp-server-buffer to a multibyte buffer.  I'm
not capable to check all the Gnus code.

>> (IIUC, copying data from a multibyte buffer to a unibyte buffer
>> causes no problem).

> I'm not sure I understand: copying data from a multibyte buffer to
> a unibyte buffer is exactly the case that can cause problems.

I agree that's generally true.  But in Gnus' case, data in a
multibyte work buffer are the multibyte version of binary data.
I don't know proper words to explain it, sorry.  In other words,
they are the one which `string-to-multibyte' converted binary
data to.  For example:

(with-temp-buffer
  (set-buffer-multibyte t)
  (insert (string-to-multibyte (encode-coding-string "日本語" 'utf-8)))
  (let ((buffer (current-buffer)))
    (with-temp-buffer
      (set-buffer-multibyte nil)
      (insert-buffer-substring buffer)
      (decode-coding-string (buffer-string) 'utf-8))))
 => "日本語"

I'm not sure it works with any data, though.

Regards,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]