[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replacement for string-as-unibyte function
From: |
Eli Zaretskii |
Subject: |
Re: Replacement for string-as-unibyte function |
Date: |
Mon, 01 Feb 2021 05:30:59 +0200 |
> Date: Sun, 31 Jan 2021 15:02:27 -0800
> From: Joe Riel <joer@san.rr.com>
>
> Eli Zaretskii asks:
> > Please describe your use case: what are you trying to do that you
> > needed string-as-unibyte?
>
> Am handling a message passed in from an external process
> (its passed in chunks).
>
> The header of the message specifies its length, in bytes.
> Some of the characters may be unicode. Am using
> buffer-substring-no-properties to later extract the message.
> To get its length write, each byte has to be a character in the buffer.
Then the text you get is already unibyte, and I see no reason to use
string-as-unibyte. Just read the text into a unibyte buffer and
process it there, then _decode_ everything when you want to present it
or process it as human-readable text.
IOW, I don't see why you'd need string-as-unibyte in this scenario.