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

Normalization of end-of-line characters #2

Closed
DrRataplan opened this issue Aug 31, 2018 · 3 comments
Closed

Normalization of end-of-line characters #2

DrRataplan opened this issue Aug 31, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@DrRataplan
Copy link

DrRataplan commented Aug 31, 2018

When I run the following in a browser:
JSON.stringify(new DOMParser().parseFromString('<p>A\r\nB</p>', 'text/xml').documentElement.textContent). It returns the following string: "A\nB"

However, in saxes, I get an ontext event with A\r\nB as the text argument.

The spec states that it is the responsibility of the 'XML processor' to normalize line endings. Since saxes is an XML parser, I'd say that saxes should normalize these line endings.

What's your opinion on this matter?

@lddubeau lddubeau added the bug Something isn't working label Aug 31, 2018
@lddubeau
Copy link
Owner

I'm thinking you're right again. Thank you for the report! This is going to complicate the parsing logic a bit because saxes allows streaming so it is not possible when encountering \r at the end of a chunk of data to know how it should be handled until the next chunk comes.

@lddubeau
Copy link
Owner

lddubeau commented Aug 31, 2018

The new release has a fix for this and the issue in your other report.

@DrRataplan
Copy link
Author

DrRataplan commented Aug 31, 2018 via email

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