unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 93be35e: Fix encoding of JSON surrogate pairs
       [not found] ` <20170101122441.55FB1220152@vcs.savannah.gnu.org>
@ 2017-01-01 14:55   ` Stefan Monnier
  2017-01-15 20:34     ` Philipp Stephani
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2017-01-01 14:55 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

> +     ;; Special-case UTF-16 surrogate pairs,
> +     ;; cf. https://tools.ietf.org/html/rfc7159#section-7.  Note that
> +     ;; this clause overlaps with the next one and therefore has to
> +     ;; come first.
> +     ((looking-at
> +       (rx (group (any "Dd") (any "89ABab") (= 2 (any "0-9A-Fa-f")))
> +           "\\u" (group (any "Dd") (any "C-Fc-f") (= 2 (any "0-9A-Fa-f")))))
> +      (json-advance 10)
> +      (json--decode-utf-16-surrogates
> +       (string-to-number (match-string 1) 16)
> +       (string-to-number (match-string 2) 16)))
>       ((looking-at "[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]")

Wouldn't it be better to move the surrogate-handling into the
hex-handling branch?


        Stefan



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Emacs-diffs] master 93be35e: Fix encoding of JSON surrogate pairs
  2017-01-01 14:55   ` [Emacs-diffs] master 93be35e: Fix encoding of JSON surrogate pairs Stefan Monnier
@ 2017-01-15 20:34     ` Philipp Stephani
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Stephani @ 2017-01-15 20:34 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel; +Cc: Philipp Stephani

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> schrieb am So., 1. Jan. 2017 um
15:56 Uhr:

> > +     ;; Special-case UTF-16 surrogate pairs,
> > +     ;; cf. https://tools.ietf.org/html/rfc7159#section-7.  Note that
> > +     ;; this clause overlaps with the next one and therefore has to
> > +     ;; come first.
> > +     ((looking-at
> > +       (rx (group (any "Dd") (any "89ABab") (= 2 (any "0-9A-Fa-f")))
> > +           "\\u" (group (any "Dd") (any "C-Fc-f") (= 2 (any
> "0-9A-Fa-f")))))
> > +      (json-advance 10)
> > +      (json--decode-utf-16-surrogates
> > +       (string-to-number (match-string 1) 16)
> > +       (string-to-number (match-string 2) 16)))
> >       ((looking-at "[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]")
>
> Wouldn't it be better to move the surrogate-handling into the
> hex-handling branch?
>

Maybe, I don't have a strong preference. The current solution avoids an
additional nested conditional though.

[-- Attachment #2: Type: text/html, Size: 1809 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-15 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170101122441.9380.61243@vcs.savannah.gnu.org>
     [not found] ` <20170101122441.55FB1220152@vcs.savannah.gnu.org>
2017-01-01 14:55   ` [Emacs-diffs] master 93be35e: Fix encoding of JSON surrogate pairs Stefan Monnier
2017-01-15 20:34     ` Philipp Stephani

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