mirror of
https://github.com/mon/kbinxml.git
synced 2026-03-21 18:04:52 -05:00
Fix unicode in attr values
This commit is contained in:
parent
d4514ea4be
commit
a6c27eef65
|
|
@ -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):
|
||||
|
|
|
|||
4
test.py
4
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!')
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<!-- Attributes plus text -->
|
||||
<entry attr="test" attr2="best" __type="str">Hello, world!</entry>
|
||||
<!-- Testing encoding, plus __type-less should become string -->
|
||||
<superstar>シ イス マイ ワイフ</superstar>
|
||||
<superstar babe="ミツル">シ イス マイ ワイフ</superstar>
|
||||
<!-- Testing 6bit conversion -->
|
||||
<xXx_T4GG3R_xXx __type="3u8">8 9 10</xXx_T4GG3R_xXx>
|
||||
<!-- Shouldn't have alignment issues from the 3u8 -->
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,7 +2,7 @@
|
|||
<test>
|
||||
<entry __type="ip4" __count="2">127.0.0.1 192.168.0.1</entry>
|
||||
<entry __type="str" attr="test" attr2="best">Hello, world!</entry>
|
||||
<superstar __type="str">シ イス マイ ワイフ</superstar>
|
||||
<superstar __type="str" babe="ミツル">シ イス マイ ワイフ</superstar>
|
||||
<xXx_T4GG3R_xXx __type="3u8">8 9 10</xXx_T4GG3R_xXx>
|
||||
<aligned __type="u8">12</aligned>
|
||||
<entry __type="bin" __size="4">deadbeef</entry>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user