From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: how to calculate the size of string in bytes? Date: Wed, 19 Aug 2015 07:43:48 +0200 Message-ID: <20150819054347.GD8432@tuxteam.de> References: <20150818101352.GA6744@tuxteam.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed X-Trace: ger.gmane.org 1439963114 3625 80.91.229.3 (19 Aug 2015 05:45:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Aug 2015 05:45:14 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 19 07:44:53 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZRwB6-0007ji-RK for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Aug 2015 07:44:48 +0200 Original-Received: from localhost ([::1]:60582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRwB6-00043O-8c for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Aug 2015 01:44:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRwAE-00033V-Lf for help-gnu-emacs@gnu.org; Wed, 19 Aug 2015 01:43:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRwAB-00025E-FF for help-gnu-emacs@gnu.org; Wed, 19 Aug 2015 01:43:54 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:37332 helo=tomasium.tuxteam.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRwAB-00024P-9x for help-gnu-emacs@gnu.org; Wed, 19 Aug 2015 01:43:51 -0400 Original-Received: from tomas by tomasium.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1ZRwA8-0002lo-3I; Wed, 19 Aug 2015 07:43:48 +0200 In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.199.139.25 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106705 Archived-At: -----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-----