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: tomas
Subject: Re: how to calculate the size of string in bytes?
Date: Wed, 19 Aug 2015 07:43:48 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Aug 18, 2015 at 05:47:27PM -0400, Stefan Monnier wrote:
> > 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.

(pats forehead) Of course! Thanks, Stefan.

regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlXUF5MACgkQBcgs9XrR2kYb6ACfakO/BHVsih4M7IPDxJfotIPD
I8kAnRYDmQF6VAnzXncPvMSjJjAOLXXS
=h0oY
-----END PGP SIGNATURE-----



reply via email to

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