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

something is wrong with html escaping #317

Open
ignis32 opened this issue Dec 18, 2022 · 1 comment
Open

something is wrong with html escaping #317

ignis32 opened this issue Dec 18, 2022 · 1 comment

Comments

@ignis32
Copy link

ignis32 commented Dec 18, 2022

Code:

import xmltodict

test_xml="""<?xml version="1.0" encoding="utf-8"?>
<a> afafafa &#8211; </a> 
"""
print(test_xml)
print (xmltodict.unparse( xmltodict.parse(test_xml) ))
 

Output:

<?xml version="1.0" encoding="utf-8"?>
<a> afafafa &#8211; </a>

<?xml version="1.0" encoding="utf-8"?>
<a>afafafa –</a>

Basically, html-encoded en-dash is unescaped when parsed, but is not escaped when unparsed, generating different result then expected. (Expectations were that output of unparse would be the same as original test_xml string)

P.S. Thank you for the lib, I found it very handy for my needs.

Repository owner deleted a comment from javadev Jan 15, 2023
@bfontaine
Copy link

See #178.

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

2 participants