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

odfpy happily inserts illegal xml characters into documents #71

Open
risicle opened this issue Oct 23, 2017 · 0 comments
Open

odfpy happily inserts illegal xml characters into documents #71

risicle opened this issue Oct 23, 2017 · 0 comments

Comments

@risicle
Copy link
Contributor

risicle commented Oct 23, 2017

Beyond escaping, certain ranges of characters are not allowed in xml documents (even if escaped by character code). These are not even allowed in CDATA sections, and the range is even more restrictive due to the use of XML 1.0 (over 1.1).

See https://en.wikipedia.org/wiki/Valid_characters_in_XML

I'm unsure what the right thing for odfpy to do would be when encountering one of these characters. Silently removing the characters seems like bad behaviour. But maybe it should at least raise a ValueError rather than generating an invalid document, leaving the responsibility of stripping/replacing them with the application.

Edit: Though, thinking about this further, it does feel like something that should be quite transparent for an odfpy user - the fact that odf is xml at all is an implementation detail, and a user shouldn't expect to have to do xml escaping to text you're trying to write to an odf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant