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

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

Re: More confusion about multibyte vs unibyte strings


From: Eric Abrahamsen
Subject: Re: More confusion about multibyte vs unibyte strings
Date: Fri, 06 May 2022 11:02:17 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stefan Monnier via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

>>>> If the search string is multibyte (in my mind this means "multiple bytes
>>>> per character", I guess that's where I went wrong), you have to encode
>>>
>>> In ELisp, "multibyte" means "a sequence of characters", whereas
>>> "unibyte" means "a sequence of bytes".
>>
>> Okay, thanks. I'd thought that distinction was covered by "encoded" vs
>> "decoded" strings. Maybe the lesson will stick this time.
>
> There's no reliable way to determine whether a string is decoded (other
> than to trace its origin and figure out what the code intended it to
> mean).
>
> This said, multibyte/unibyte can be used as an approximation of
> decoded/encoded (my own local hacks include signaling errors when
> trying to decode a multibyte string or to encode a unibyte string, but
> it trips over various places where we do that for legitimate
> reasons :-( )

Thanks for this explanation! I'm grateful that my bit of code doesn't
actually need to be that complicated...




reply via email to

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