1
0
mirror of https://github.com/golang/go synced 2024-11-23 10:00:03 -07:00
go/src/html
empijei d4d298040d html/template,text/template: switch to Unicode escapes for JSON compatibility
The existing implementation is not compatible with JSON
escape as it uses hex escaping.
Unicode escape, instead, is valid for both JSON and JS.
This fix avoids creating a separate escaping context for
scripts of type "application/ld+json" and it is more
future-proof in case more JSON+JS contexts get added
to the platform (e.g. import maps).

Fixes #33671
Fixes #37634

Change-Id: Id6f6524b4abc52e81d9d744d46bbe5bf2e081543
Reviewed-on: https://go-review.googlesource.com/c/go/+/226097
Reviewed-by: Carl Johnson <me@carlmjohnson.net>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-16 17:13:33 +00:00
..
template html/template,text/template: switch to Unicode escapes for JSON compatibility 2020-04-16 17:13:33 +00:00
entity_test.go html: lazily populate Unescape tables 2018-07-31 22:10:54 +00:00
entity.go html: lazily populate Unescape tables 2018-07-31 22:10:54 +00:00
escape_test.go
escape.go html: update URL in comment 2020-01-13 07:00:18 +00:00
example_test.go
fuzz.go html: add a Fuzz function 2019-04-30 15:48:46 +00:00