From 902a49804d880baf2d1b58ce0cf07ce7599df1fc Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Wed, 9 Oct 2019 10:15:55 +1300 Subject: [PATCH] gpo: Force top level XML to always be UTF-8 Signed-off-by: Garming Sam --- python/samba/gp_parse/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/samba/gp_parse/__init__.py b/python/samba/gp_parse/__init__.py index 8ddd52d3657..2371e989315 100644 --- a/python/samba/gp_parse/__init__.py +++ b/python/samba/gp_parse/__init__.py @@ -55,7 +55,7 @@ def entity_type_to_string(ent_type): # [MS-GPWL] Wireless/Wired Protocol Extension (LDAP) class GPParser(object): encoding = 'utf-16' - output_encoding = 'utf-8' + _output_encoding = 'utf-8' def parse(self, contents): pass @@ -76,10 +76,10 @@ class GPParser(object): et = ElementTree(xml_element) temporary_bytes = BytesIO() - et.write(temporary_bytes, encoding=self.output_encoding, + et.write(temporary_bytes, encoding=self._output_encoding, xml_declaration=True) minidom_parsed = minidom.parseString(temporary_bytes.getvalue()) - handle.write(minidom_parsed.toprettyxml(encoding=self.output_encoding)) + handle.write(minidom_parsed.toprettyxml(encoding=self._output_encoding)) def new_xml_entity(self, name, ent_type): identifier = md5(get_bytes(name)).hexdigest() -- 2.17.1