[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replacement for string-as-unibyte-function
From: |
Stefan Monnier |
Subject: |
Re: Replacement for string-as-unibyte-function |
Date: |
Sun, 31 Jan 2021 22:03:42 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> 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.
So make sure the buffer in which the process writes is unibyte with
(set-buffer-multibyte nil)
and make sure Emacs doesn't try to decode the process's output:
(set-process-coding-system <proc> 'binary)
(which you can also set directly when you launch the process, but how
you do it depends on the function you use to create the process).
Stefan