From b1339d6c4b332357970a08ac2f7977c664abc855 Mon Sep 17 00:00:00 2001 From: William Toohey Date: Fri, 10 Jul 2020 09:26:55 +1000 Subject: [PATCH] Fix strings with extra NUL padding --- kbinxml/kbinxml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kbinxml/kbinxml.py b/kbinxml/kbinxml.py index 4dea4bc..e750c09 100644 --- a/kbinxml/kbinxml.py +++ b/kbinxml/kbinxml.py @@ -377,7 +377,8 @@ class KBinXML(): else: string = ' '.join(map(nodeFormat.get('toStr', str), data)) - node.text = string + # some strings have extra NUL bytes, compatible behaviour is to strip + node.text = string.strip('\0') # because we need the 'real' root self.xml_doc = self.xml_doc[0]