mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
encoding/json: drop MarshalForHTML; gofix calls to Marshal.
I've elected to omit escaping the output of Marshalers for now. I haven't thought through the implications of that; I suspect that double escaping might be the undoing of that idea. Fixes #3127. R=golang-dev, r CC=golang-dev https://golang.org/cl/5694098
This commit is contained in:
parent
740d503866
commit
9dd746c4cb
4 changed files with 10 additions and 21 deletions
|
|
@ -239,16 +239,6 @@ func TestEscape(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestHTMLEscape(t *testing.T) {
|
||||
b, err := MarshalForHTML("foobarbaz<>&quux")
|
||||
if err != nil {
|
||||
t.Fatalf("MarshalForHTML error: %v", err)
|
||||
}
|
||||
if !bytes.Equal(b, []byte(`"foobarbaz\u003c\u003e\u0026quux"`)) {
|
||||
t.Fatalf("Unexpected encoding of \"<>&\": %s", b)
|
||||
}
|
||||
}
|
||||
|
||||
// WrongString is a struct that's misusing the ,string modifier.
|
||||
type WrongString struct {
|
||||
Message string `json:"result,string"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue