From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Replacement for string-as-unibyte function
Date: Mon, 01 Feb 2021 05:30:59 +0200 [thread overview]
Message-ID: <83eei079cc.fsf@gnu.org> (raw)
In-Reply-To: <20210131150227.24330f64@gauss> (message from Joe Riel on Sun, 31 Jan 2021 15:02:27 -0800)
> 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.
next prev parent reply other threads:[~2021-02-01 3:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-31 23:02 Replacement for string-as-unibyte function Joe Riel
2021-02-01 3:30 ` Eli Zaretskii [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-01-31 0:34 Joe Riel
2021-01-31 2:40 ` moasenwood--- via Users list for the GNU Emacs text editor
2021-01-31 3:35 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83eei079cc.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).