unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: emacs-devel@gnu.org, joaotavora@gmail.com, vibhavp@gmail.com,
	monnier@iro.umontreal.ca
Subject: Re: New jrpc.el JSONRPC library (Was: [ELPA] New package: eglot)
Date: Sat, 19 May 2018 17:11:01 +0300	[thread overview]
Message-ID: <83lgcfhh1m.fsf@gnu.org> (raw)
In-Reply-To: <CAArVCkTWAGn=+sjDjByorFqqHgrFnL2ytCmE1i-a5Y8AztgJCQ@mail.gmail.com> (message from Philipp Stephani on Sat, 19 May 2018 13:34:45 +0200)

> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sat, 19 May 2018 13:34:45 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, monnier@iro.umontreal.ca, vibhavp@gmail.com, 
> 	emacs-devel@gnu.org
> 
> - I think `string-bytes' isn't guaranteed to return the number of UTF-8
> bytes.

Yes, it is guaranteed.  See its implementation.

There could be a problem if the original string includes raw bytes --
then the value returned by string-bytes will not match the length of
the bytestream after encoding by UTF-8.  But since JSON requires UTF-8
without any raw bytes, I'm not sure it matters that we will send an
incorrect byte count in that case, because it means there's a bug in
the Lisp program which produced the string.

> Rather you should encode the string explicitly to a unibyte string
> using `encode-coding-string', and then use `no-conversion' for the process
> coding systems.

That's possible, but since process-send-string encodes the string, it
should be enough to bind coding-system-for-write to utf-8, and let
process-send-string encode it.  Assuming we trust the caller to
produce a string without raw bytes, that is.



  reply	other threads:[~2018-05-19 14:11 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 22:34 [ELPA] New package: eglot João Távora
2018-05-11  6:19 ` Eli Zaretskii
2018-05-11 11:29   ` João Távora
2018-05-11 12:15     ` Eli Zaretskii
2018-05-18 16:27   ` New jrpc.el JSONRPC library (Was: [ELPA] New package: eglot) João Távora
2018-05-19  8:46     ` Eli Zaretskii
2018-05-20 15:54       ` New jrpc.el JSONRPC library João Távora
2018-05-20 16:02         ` Eli Zaretskii
2018-05-29  1:08           ` João Távora
2018-06-28 12:13           ` [PATCH] jsonrpc.el João Távora
2018-06-28 13:18             ` Eli Zaretskii
2018-06-28 13:23               ` João Távora
2018-06-28 13:40                 ` Eli Zaretskii
2018-05-20 19:13         ` New jrpc.el JSONRPC library Clément Pit-Claudel
2018-05-20 20:35           ` Josh Elsasser
2018-05-20 23:22             ` João Távora
2018-05-21  3:32               ` Josh Elsasser
2018-05-20 23:11           ` João Távora
2018-05-21  0:14             ` Clément Pit-Claudel
2018-05-19 11:34     ` New jrpc.el JSONRPC library (Was: [ELPA] New package: eglot) Philipp Stephani
2018-05-19 14:11       ` Eli Zaretskii [this message]
2018-05-20 15:43       ` New jrpc.el JSONRPC library João Távora
2018-05-20 16:06         ` Eli Zaretskii
2018-05-20 16:18           ` João Távora
2018-05-21 13:30         ` Aaron Ecay
2018-05-21 13:43           ` João Távora
2018-05-21 14:37             ` Aaron Ecay
2018-05-21 19:06               ` João Távora
2018-05-23 17:57                 ` Aaron Ecay
2018-05-23 18:02                   ` Stefan Monnier
2018-05-23 20:40                   ` João Távora
2018-05-24  2:07                     ` Stefan Monnier
2018-05-21 14:42             ` Stefan Monnier
2018-05-24 10:02         ` Philipp Stephani
2018-05-24 17:25           ` João Távora
2018-05-12 15:47 ` [ELPA] New package: eglot Stefan Monnier
2018-05-14 10:55   ` Bozhidar Batsov
2018-05-14 14:14   ` João Távora

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=83lgcfhh1m.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=p.stephani2@gmail.com \
    --cc=vibhavp@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).