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: ,innerxml values are not escaped. #16604

Closed
txgruppi opened this issue Aug 4, 2016 · 6 comments
Closed

encoding/xml: ,innerxml values are not escaped. #16604

txgruppi opened this issue Aug 4, 2016 · 6 comments
Milestone

Comments

@txgruppi
Copy link

txgruppi commented Aug 4, 2016

  1. What version of Go are you using (go version)?
go version go1.6.3 darwin/amd64
  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
  1. What did you do?
    https://play.golang.org/p/r-pLR_UIXe
  2. What did you expect to see?
<Company>Test &amp; Test</Company>
  1. What did you see instead?
<Company>Test & Test</Company>

This is causing problems for other software to parse the generated XML file.

@quentinmit quentinmit added this to the Go1.8 milestone Aug 8, 2016
@quentinmit
Copy link
Contributor

The docs do say "a field with tag ",innerxml" is written verbatim, not subject to the usual marshalling procedure". I feel like we probably can't change the behavior at this point.

What made you think that ampersands would be escaped?

@txgruppi
Copy link
Author

txgruppi commented Aug 8, 2016

I got problems when using xmllint or parsing the file using python so I imagined it was an error.

@minux
Copy link
Member

minux commented Aug 9, 2016 via email

@txgruppi
Copy link
Author

txgruppi commented Aug 9, 2016

I understand it, the user has to provide a valid value for the field. I'm sorry about it.

@kostya-sh
Copy link
Contributor

If you need automatic escaping you should use ,chardata: https://play.golang.org/p/nJEc61MqkK

@txgruppi
Copy link
Author

txgruppi commented Aug 9, 2016

@kostya-sh this is great! :)

Thanks.

@golang golang locked and limited conversation to collaborators Aug 9, 2017
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

6 participants