Skip to content
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

encoding/xml: newlines in char data should not be escaped #9204

Closed
rogpeppe opened this issue Dec 4, 2014 · 6 comments
Closed

encoding/xml: newlines in char data should not be escaped #9204

rogpeppe opened this issue Dec 4, 2014 · 6 comments
Milestone

Comments

@rogpeppe
Copy link
Contributor

rogpeppe commented Dec 4, 2014

http://play.golang.org/p/KeJh6ASgx0

This actually has real-world issues, as some clients
(e.g. Chrome's SVG renderer) do not treat the 

escape as white space and fail as a result.

Solving this would make for smaller output too.
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-go1.5.

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014
@zimmski
Copy link
Contributor

zimmski commented Dec 16, 2014

Additionally to \n, \r and \t are escaped too, so I guess if one is removed, the others should go too. I thought this would be easily fixable, since this touches just a few lines, but I am concerned that it would break other applications. According to http://www.w3.org/TR/2006/REC-xml11-20060816/#sec-white-space and http://msdn.microsoft.com/en-us/library/ms256097%28v=vs.110%29.aspx white spaces in the content should be preserved which brings up the question why they are escaped in the first place. Maybe the original author could say something about this?

@bradfitz bradfitz removed the new label Dec 18, 2014
@xogeny
Copy link

xogeny commented Feb 10, 2015

I recently ran across this issue as well. Am I correct that this won't be fixed until 1.5? Any suggested workarounds?

@rsc rsc removed the repo-main label Apr 14, 2015
@roblillack
Copy link

@xogeny, it's not a real plug-in replacement, but for my use case (modifying specific text content in otherwise untouched XML files) I just wrote a pretty dump, quick-and-dirty XML tokenizer from scratch. There's no namespace handling or even parsing of attributes but it works for me: https://github.com/roblillack/gockl

@nightlyone
Copy link
Contributor

@rogpeppe didn't you just fix that yesterday with https://golang.org/cl/9310 merged as 4a3e000?

@minux
Copy link
Member

minux commented Apr 29, 2015

It's fixed by https://golang.org/cl/9310.

@minux minux closed this as completed Apr 29, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants