merge_compatibility_list.py: Use UTF-8 encoding in output
This commit is contained in:
parent
78d9085c2e
commit
302e137aa3
|
@ -10,8 +10,8 @@ def prettify(elem):
|
||||||
"""
|
"""
|
||||||
rough_string = ET.tostring(elem, 'utf-8')
|
rough_string = ET.tostring(elem, 'utf-8')
|
||||||
reparsed = minidom.parseString(rough_string)
|
reparsed = minidom.parseString(rough_string)
|
||||||
dom_string = reparsed.toprettyxml(indent=" ")
|
dom_string = reparsed.toprettyxml(encoding="utf-8",indent=" ")
|
||||||
return '\n'.join([s for s in dom_string.splitlines() if s.strip()])
|
return b'\n'.join([s for s in dom_string.splitlines() if s.strip()])
|
||||||
|
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/25338817/sorting-xml-in-python-etree/25339725#25339725
|
# https://stackoverflow.com/questions/25338817/sorting-xml-in-python-etree/25339725#25339725
|
||||||
|
@ -53,7 +53,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
sortchildrenby(new_tree.getroot(), "title")
|
sortchildrenby(new_tree.getroot(), "title")
|
||||||
|
|
||||||
output_file = open(args.output_list, "w")
|
output_file = open(args.output_list, "wb")
|
||||||
output_file.write(prettify(new_tree.getroot()))
|
output_file.write(prettify(new_tree.getroot()))
|
||||||
output_file.close()
|
output_file.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue