Subject: bug#24784: closed (Re: bug#24784: 26.0.50; JSON strings with utf-16 escape codes)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 01 Jan 2017 12:27:02 +0000

Your bug report

#24784: 26.0.50; JSON strings with utf-16 escape codes

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
24784: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24784
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#24784: 26.0.50; JSON strings with utf-16 escape codes
From: Philipp Stephani <[email-masked]>
To: Dmitry Gutov <[email-masked]>, Helmut Eller <[email-masked]>, [email-masked]
Date: Sun, 01 Jan 2017 12:26:07 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Dmitry Gutov <[email-masked]> schrieb am So., 1. Jan. 2017 um 01:45 Uhr:

> On 31.12.2016 19:53, Philipp Stephani wrote:
>
> > Agreed; converted to defun. I've only used defsubst because some other
> > helper functions also used defsubst.
>
> Thanks. Those others can probably be changed as well.
>

Yes, but rather not in this commit.

>
> > No, the below case is more general and therefore has to come last.
>
> Makes sense.
>

> > It's not 100% related to the patch, but I think it can be included for
> > symmetry reasons (testing encoding as well as decoding).
>
> Of course. These are testing utf-8 encoding, though, right? It would be
> better if you split them to a separate commit, I think.
>

OK, I've removed it from this patch and pushed it as 93be35e038.

Subject: 26.0.50; JSON strings with utf-16 escape codes
From: Helmut Eller <[email-masked]>
To: [email-masked]
Date: Mon, 24 Oct 2016 20:06:18 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

json-read-from-string doesn't parse strings correctly if the the \u
syntax is used to write UTF-16 surrogates:

 (equal (json-read-from-string "\"\\uD834\\uDD1E\"") "\"\U0001D11E\"")
 => nil

The correct result t.  To quote RFC 7159[*]:

   To escape an extended character that is not in the Basic Multilingual
   Plane, the character is represented as a 12-character sequence,
   encoding the UTF-16 surrogate pair.  So, for example, a string
   containing only the G clef character (U+1D11E) may be represented as
   "\uD834\uDD1E".

[*] https://tools.ietf.org/html/rfc7159#section-7

In GNU Emacs 26.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
 of 2016-10-24 built on caladan
Repository revision: 26ccd19269c040ad5960a7567aa5fc88f142c709
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.5 (jessie)

Configured using:
 'configure --with-xpm=no --with-jpeg=no --with-gif=no --with-tiff=no'

Configured features:
PNG SOUND DBUS GSETTINGS NOTIFY GNUTLS LIBXML2 FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix