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

rogpeppe opened this Issue Dec 4, 2014 · 6 comments


None yet
10 participants
Copy link

rogpeppe commented Dec 4, 2014

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.

This comment has been minimized.

Copy link

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


This comment has been minimized.

Copy link

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 and 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


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


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:


This comment has been minimized.

Copy link

nightlyone commented Apr 28, 2015

@rogpeppe didn't you just fix that yesterday with merged as 4a3e000?


This comment has been minimized.

Copy link

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.