[PATCH 2 of 3] templater: replace jsonescape in main json templater (issue4926)
Yuya Nishihara
yuya at tcha.org
Wed Jan 13 13:01:05 UTC 2016
On Tue, 12 Jan 2016 11:01:06 -0600, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1452542432 21600
> # Mon Jan 11 14:00:32 2016 -0600
> # Node ID 35d049d7e5a2dec87318ce8042844f56e107cf83
> # Parent 544d391bd3b42b96975a3521b73c25223db930b0
> templater: replace jsonescape in main json templater (issue4926)
>
> This version differs in a couple ways:
>
> - it skips optional escaping of codepoints > U+007f
> - it thus handles emoji correctly (JSON requires UTF-16 surrogates)
> - but it may run afoul of silly Unicode linebreaks if exec'd in js
> - it uses UTF-8b to round-trip undecodeable bytes
We can't do that because JSON output can be embedded in non-UTF-8 HTML,
where only 7bit ASCII is allowed, and JSON input (i.e. template string)
is a local-encoding text in general.
I have patch series to fix the issue4926, but I found my patch seems to have
the emoji issue right now.
More information about the Mercurial-devel
mailing list