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

Comments

Projects
None yet
10 participants
@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

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Dec 4, 2014

Comment 1:

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

@rogpeppe rogpeppe added new labels Dec 4, 2014

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014

@bradfitz bradfitz removed the release-go1.5 label Dec 16, 2014

@zimmski

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

roblillack commented Apr 20, 2015

@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

This comment has been minimized.

Copy link
Contributor

nightlyone commented Apr 28, 2015

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

@minux

This comment has been minimized.

Copy link
Member

minux commented Apr 29, 2015

@minux minux closed this 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.
You can’t perform that action at this time.