-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
html/template: Go 1.8 has a different encoding logic. Intentionally? #18159
Comments
I don't see any obvious commit during Go 1.8 which would've caused this, unless the change wasn't in the html/template package. @rsc, do you know off hand?
|
The change that caused it was made commit ffd1c78, CL https://go-review.googlesource.com/c/14336/ which was merged on 29th September 2016, The problem stems from this helper function Lines 381 to 398 in ffd1c78
![]() /cc @nodirt |
@odeke-em thanks for investigating. Adding |
CL https://golang.org/cl/33899 mentions this issue. |
CL https://golang.org/cl/33901 mentions this issue. |
CL https://go-review.googlesource.com/33899 added application/json as a mimeType for valid JS. Let's lock that fix in with a test. Updates #18159 Change-Id: Ic4dfd8929aebfc5410f796688f081ca06630f672 Reviewed-on: https://go-review.googlesource.com/33901 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Nodir Turakulov <nodir@google.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
I'm fairly certain this change is related to a breakage I'm seeing with the Javascript templating framework EJS. In 1.7 I'm able to embed the following directly into my document and have it come out unadulterated:
As of 1.8 the EJS template gets mangled due to escaping:
If this is desired behavior, is there a workaround? |
@anthonybishopric, you're commenting on a closed bug. If you want somebody to see it and consider it for Go 1.8, please file a new bug. |
@bradfitz Thanks, sorry I didn't see the closed indicator. Will open a new issue |
What version of Go are you using (
go version
)?Go 1.8 beta (130ad87)
What operating system and processor architecture are you using (
go env
)?Ubuntu, OS X
What did you do?
What did you expect to see?
Works fine with this version of Go
What did you see instead?
Strings do not match: got '<script type="application/json">{"name":"Peter"}</script>', want '<script type="application/json">{"name":"Peter"}</script>'
If that's how it should look like with Go 1.8, how can I get back the old behaviour?
The text was updated successfully, but these errors were encountered: