Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(228)

Issue 12708044: code review 12708044: encoding/json: escape & always (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by rsc
Modified:
11 years, 7 months ago
Reviewers:
bradfitz
CC:
golang-dev, bradfitz
Visibility:
Public.

Description

encoding/json: escape & always There are a few different places in the code that escape possibly-problematic characters like < > and &. This one was the only one missing &, so add it. This means that if you Marshal a string, you get the same answer you do if you Marshal a string and pass it through the compactor. (Ironically, the compaction makes the string longer.) Because html/template invokes json.Marshal to prepare escaped strings for JavaScript, this changes the form of some of the escaped strings, but not their meaning.

Patch Set 1 #

Patch Set 2 : diff -r b1c9e72c2ca3 https://code.google.com/p/go/ #

Patch Set 3 : diff -r b1c9e72c2ca3 https://code.google.com/p/go/ #

Patch Set 4 : diff -r 690c179cc3fd https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -8 lines) Patch
M src/pkg/encoding/json/encode.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/html/template/content_test.go View 1 1 chunk +6 lines, -6 lines 0 comments Download
M src/pkg/html/template/escape_test.go View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 3
rsc
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
11 years, 7 months ago (2013-08-09 20:39:08 UTC) #1
bradfitz
LGTM
11 years, 7 months ago (2013-08-09 21:18:42 UTC) #2
rsc
11 years, 7 months ago (2013-08-09 22:34:00 UTC) #3
*** Submitted as https://code.google.com/p/go/source/detail?r=94e37af95560 ***

encoding/json: escape & always

There are a few different places in the code that escape
possibly-problematic characters like < > and &.
This one was the only one missing &, so add it.

This means that if you Marshal a string, you get the
same answer you do if you Marshal a string and
pass it through the compactor. (Ironically, the
compaction makes the string longer.)

Because html/template invokes json.Marshal to
prepare escaped strings for JavaScript, this changes
the form of some of the escaped strings, but not
their meaning.

R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/12708044
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b