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: Stefan Monnier
Subject: Re: [Unicode-2] `read' always returns multibyte symbol
Date: Wed, 14 Nov 2007 20:15:37 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>>> !     ;; Use a unibyte buffer in order to make `read' read non-ASCII
>>> !     ;; group names (which have been encoded) as unibyte strings.
>>> !     (mm-with-unibyte-buffer
>>> !       (insert-buffer-substring cur)

>> Why is `cur' a multibyte buffer?  Since it contains encoded strings, I'd
>> expect it would be better (more robust and convenient) to use a unibyte
>> buffer for it.

> Good point.  The `cur' is `nntp-server-buffer' (" *nntpd*") or
> `gnus-work-buffer' (" *gnus work*") as the case may be.

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.

> Gnus uses those buffers for various purposes.  Although there looks no
> situation where it is necessary to have multibyte data as far as I can
> observe, Gnus explicitly sets them as multibyte buffers (see
> `nnheader-init-server-buffer' and `gnus-set-work-buffer').

> I believe the reason they do so is to prevent from breaking data when
> copying them to another multibyte buffer (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.


        Stefan




reply via email to

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