help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Why does using aset sometimes output raw bytes?


From: Stephen Berman
Subject: Re: Why does using aset sometimes output raw bytes?
Date: Sun, 09 Dec 2018 16:56:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Sun, 09 Dec 2018 16:46:01 +0100 Stephen Berman <stephen.berman@gmx.net> 
wrote:

> On Sun, 09 Dec 2018 17:20:13 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
>
>>> Here's what gets inserted into the buffer (I've represented the raw
>>> bytes by ascii strings to make sure they're readable here):
>>> 
>>> \344\366\374\337ſðđŋ
>>> äöüßſðđŋ
>>> 
>>> Is this expected, and if so, what's the explanation, i.e., why does this
>>> happen with some non-ascii characters (e.g. äöüß) but not with others
>>> (e.g ſðđŋ) and why does it happen when aset gets passed a variable
>>> for the string but not when it gets passed the string itself?
>>
>> s0 and s2 originally include only pure ASCII characters, so they are
>> unibyte strings.  Try making them multibyte before using aset.
>
> Thanks, that works.  But why are raw bytes inserted only with some
> multibyte strings (e.g. with "äöüß" but not with "ſðđŋ")?  Also, is
> there some way to ensure a string is handled as multibyte if it's not
> known what characters it contains?  E.g., s0 in my example sexp could be
> bound to some string by a function call and before applying the function
> it is not known if the string is multibyte; is there some way in Lisp to
> say "treat the value of s0 as multibyte (regardless of what characters
> it contains)"?

Also "aous" is also pure ASCII, so why don't raw bytes get inserted with
(insert (aset "aous" i (aref "äöüß" i)))?

Steve Berman



reply via email to

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