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

Control characters not escaped when creating an xml document #116

Open
benasher44 opened this issue Jan 20, 2022 · 0 comments
Open

Control characters not escaped when creating an xml document #116

benasher44 opened this issue Jan 20, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@benasher44
Copy link

benasher44 commented Jan 20, 2022

Describe the bug
We wound up with a control character in a document we intended to serialize to XML using xmlbuilder2, and we found that it doesn't end up escaping, throwing them out, or error.

To Reproduce
The following results

create({ encoding: "utf-8", version: "1.0" }, { test: { value: "\b" } }).end()

If I use Jest's inline snapshot functionality, I get something that looks like this in VSCode (shows the control character, un-escaped with VSCode's representation of it):

image

Expected behavior
Ideally it would escape them (though not sure XML 1.0 allows this). If escaping isn't possible, ideally there would be an option to throw them out silently or error.

Version:

  • node.js: 16 LTS
  • xmlbuilder2: 3.0.2 (though tried 2.x as well)

Additional context
Happy to provide more (though feel like repro case should capture it)! Thanks for your help!

@benasher44 benasher44 added the bug Something isn't working label Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants