all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Cc: Philipp Stephani <phst@google.com>
Subject: Re: [Emacs-diffs] master 93be35e: Fix encoding of JSON surrogate pairs
Date: Sun, 15 Jan 2017 20:34:27 +0000	[thread overview]
Message-ID: <CAArVCkTwqCSpKsnKcBSHXZDWMu0eA7YGTqnHPSw2Nuy0CyKanA@mail.gmail.com> (raw)
In-Reply-To: <jwv60ly6dbe.fsf-monnier+emacsdiffs@gnu.org>

[-- 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 --]

      reply	other threads:[~2017-01-15 20:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAArVCkTwqCSpKsnKcBSHXZDWMu0eA7YGTqnHPSw2Nuy0CyKanA@mail.gmail.com \
    --to=p.stephani2@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=phst@google.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.