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

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

Re: how to calculate the size of string in bytes?


From: Stefan Monnier
Subject: Re: how to calculate the size of string in bytes?
Date: Tue, 18 Aug 2015 17:47:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> It seems somewhat wasteful to encode msg (to find its length) just
> to let process-send-string encode again -- perhaps there's a better
> idiom around for that.

Yup: communicate with the process using bytes rather than chars!

I.e. set the process's coding system to binary.

Then you just need to call (encode-coding-string msg coding-system) once
to get the bytes and you send them as is: they won't be re-encoded.


        Stefan




reply via email to

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