diff --git a/mitmproxy/contentviews.py b/mitmproxy/contentviews.py index 706fa5ede..331a706f4 100644 --- a/mitmproxy/contentviews.py +++ b/mitmproxy/contentviews.py @@ -172,7 +172,7 @@ class ViewHex(View): def _format(data): for offset, hexa, s in strutils.hexdump(data): yield [ - ("offset", offset + b" "), + ("offset", offset + " "), ("text", hexa + " "), ("text", s) ] diff --git a/netlib/strutils.py b/netlib/strutils.py index 9208f954c..a51df8868 100644 --- a/netlib/strutils.py +++ b/netlib/strutils.py @@ -146,7 +146,7 @@ def hexdump(s): A generator of (offset, hex, str) tuples """ for i in range(0, len(s), 16): - offset = "{:0=10x}".format(i).encode() + offset = "{:0=10x}".format(i) part = s[i:i + 16] x = " ".join("{:0=2x}".format(i) for i in six.iterbytes(part)) x = x.ljust(47) # 16*2 + 15