xmltodict
xmltodict copied to clipboard
Urlencoding is converted to charectrers
So trying to parse jenkins jobs, And it seesm url-encoded charecrters are converted to quotations.
Example:
import xmltodict
a = """<?xml version='1.0' encoding='UTF-8'?>
<command>echo "Hello World" </command>
"""
print(xmltodict.unparse(xmltodict.parse(a), None, 'UTF-8', True, True, pretty=True))
Expected output:
<?xml version="1.0" encoding="UTF-8"?>
<command>echo "Hello World"</command>
Actual output:
<?xml version="1.0" encoding="UTF-8"?>
<command>echo "Hello World"</command>
Got a message that someone commmented and deleted:
Seems like it's a bug in sax python core library element.
We have two similar methods in python/Lib/xml/sax/saxutils.py: def escape() and def unescape(). I don't know why but there's no quotation escaping in escape() but unescape() has it.
I've tried to replace the return statement from return data to return data.replace("\"", """) and it worked great.