From 302e137aa33af4091093abcbc486fffb489fc40b Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 23 May 2020 19:25:39 +1000 Subject: [PATCH] merge_compatibility_list.py: Use UTF-8 encoding in output --- scripts/merge_compatibility_list.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/merge_compatibility_list.py b/scripts/merge_compatibility_list.py index 3fa384759..7a6d5c9c9 100644 --- a/scripts/merge_compatibility_list.py +++ b/scripts/merge_compatibility_list.py @@ -10,8 +10,8 @@ def prettify(elem): """ rough_string = ET.tostring(elem, 'utf-8') reparsed = minidom.parseString(rough_string) - dom_string = reparsed.toprettyxml(indent=" ") - return '\n'.join([s for s in dom_string.splitlines() if s.strip()]) + dom_string = reparsed.toprettyxml(encoding="utf-8",indent=" ") + 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 @@ -53,7 +53,7 @@ if __name__ == "__main__": 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.close()