strutils.hexdump returns native_strings

This commit is contained in:
Shadab Zafar 2016-07-09 12:43:21 +05:30
parent c7cbbf5f0d
commit 0a21d27004
2 changed files with 2 additions and 2 deletions

View File

@ -172,7 +172,7 @@ class ViewHex(View):
def _format(data): def _format(data):
for offset, hexa, s in strutils.hexdump(data): for offset, hexa, s in strutils.hexdump(data):
yield [ yield [
("offset", offset + b" "), ("offset", offset + " "),
("text", hexa + " "), ("text", hexa + " "),
("text", s) ("text", s)
] ]

View File

@ -146,7 +146,7 @@ def hexdump(s):
A generator of (offset, hex, str) tuples A generator of (offset, hex, str) tuples
""" """
for i in range(0, len(s), 16): for i in range(0, len(s), 16):
offset = "{:0=10x}".format(i).encode() offset = "{:0=10x}".format(i)
part = s[i:i + 16] part = s[i:i + 16]
x = " ".join("{:0=2x}".format(i) for i in six.iterbytes(part)) x = " ".join("{:0=2x}".format(i) for i in six.iterbytes(part))
x = x.ljust(47) # 16*2 + 15 x = x.ljust(47) # 16*2 + 15