encoding/json: unexpected output with SetEscapeHTML(false) #20581
Milestone
Comments
What is If there's a bug in the standard library, please report what the standard library is doing (with a code example) and what output you expect. |
Thanks, maybe our usage error, the test code as follows:
output
expect
|
There's a newline at the end of end of your string after the double quote, so your strings.Trim isn't trimming the double quote. I don't see a bug in Go here. |
Thanks a lot. I have found that |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8 linux/amd64
and
go version go1.8.3 linux/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/wangxin/work/golang:/home/wangxin/work/golang/src/unicontract"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build900066718=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
In order to get the same serialize result for json data in java(gson), js(sort keys by alph...) , python(rapaidjson) and golang(encoding/json), I found the golang set the htmlescape flag true and it`s result is not the same as others, so I rewrite the encoder and got the output.
The test code as follows:
The fully output as follows:
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: