From a6c27eef65939c933df40f3c28798d764fe2c234 Mon Sep 17 00:00:00 2001 From: William Toohey Date: Fri, 21 Jul 2017 01:00:13 +1000 Subject: [PATCH] Fix unicode in attr values --- kbinxml.py | 4 ++-- test.py | 4 ++-- testcases.xml | 2 +- testcases_out.kbin | Bin 1392 -> 1408 bytes testcases_out.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kbinxml.py b/kbinxml.py index c3caba1..87c8ce8 100644 --- a/kbinxml.py +++ b/kbinxml.py @@ -67,13 +67,13 @@ class KBinXML(): def data_grab_auto(self): size = self.dataBuf.get_s32() - ret = self.dataBuf.get('b', size) + ret = self.dataBuf.get('B', size) self.dataBuf.realign_reads() return ret def data_append_auto(self, data): self.dataBuf.append_s32(len(data)) - self.dataBuf.append(data, 'b', len(data)) + self.dataBuf.append(data, 'B', len(data)) self.dataBuf.realign_writes() def data_grab_string(self): diff --git a/test.py b/test.py index 6b1b8bb..81ecbad 100644 --- a/test.py +++ b/test.py @@ -12,9 +12,9 @@ with open('testcases_out.kbin', 'rb') as f: k = KBinXML(xml_in) kbin = k.to_binary() if kbin != expected_bin: - with open('failed_test.bin', 'wb') as f: + with open('failed_test.kbin', 'wb') as f: f.write(kbin) - raise AssertionError('Binary output does not match, check failed_test.bin') + raise AssertionError('Binary output does not match, check failed_test.kbin') else: print('XML -> Binary correct!') diff --git a/testcases.xml b/testcases.xml index c7d7bb2..d4749cc 100644 --- a/testcases.xml +++ b/testcases.xml @@ -6,7 +6,7 @@ Hello, world! - ƒV@ƒCƒX@ƒ}ƒC@ƒƒCƒt + ƒV@ƒCƒX@ƒ}ƒC@ƒƒCƒt 8 9 10 diff --git a/testcases_out.kbin b/testcases_out.kbin index 31fdc4819add356d46f5080744041c948ba56cd7..f258d5c486b91cc926237b37182d86a9f7231fbd 100644 GIT binary patch delta 49 zcmeys)xgcMz^S30fq}_nB8NJw9?QJUR~z-Yn3$LyCfhKDa4|42us7E=CpUL*?qhny F1OQRI4iEqU delta 33 pcmZqR{=mhtz^S30fq}_jB8U1$6D}rZ24<7V4oo4N7cf0w0sxr92 127.0.0.1 192.168.0.1 Hello, world! - ใ‚ทใ€€ใ‚คใ‚นใ€€ใƒžใ‚คใ€€ใƒฏใ‚คใƒ• + ใ‚ทใ€€ใ‚คใ‚นใ€€ใƒžใ‚คใ€€ใƒฏใ‚คใƒ• 8 9 10 12 deadbeef