mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
fix pathod log encoding
This commit is contained in:
parent
811b72cd30
commit
8b564bc934
@ -156,8 +156,8 @@ def hexdump(s):
|
|||||||
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
|
||||||
part_repr = escape_control_characters(
|
part_repr = native(escape_control_characters(
|
||||||
part.decode("ascii", "replace").replace(u"\ufffd", u"."),
|
part.decode("ascii", "replace").replace(u"\ufffd", u"."),
|
||||||
False
|
False
|
||||||
)
|
))
|
||||||
yield (offset, x, part_repr)
|
yield (offset, x, part_repr)
|
||||||
|
@ -62,9 +62,15 @@ class LogCtx(object):
|
|||||||
for line in strutils.hexdump(data):
|
for line in strutils.hexdump(data):
|
||||||
self("\t%s %s %s" % line)
|
self("\t%s %s %s" % line)
|
||||||
else:
|
else:
|
||||||
data = data.decode("ascii", "replace").replace(u"\ufffd", u".")
|
data = strutils.native(
|
||||||
for i in strutils.escape_control_characters(data).split(u"\n"):
|
strutils.escape_control_characters(
|
||||||
self(u"\t%s" % i)
|
data
|
||||||
|
.decode("ascii", "replace")
|
||||||
|
.replace(u"\ufffd", u".")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
for i in data.split("\n"):
|
||||||
|
self("\t%s" % i)
|
||||||
|
|
||||||
def __call__(self, line):
|
def __call__(self, line):
|
||||||
self.lines.append(line)
|
self.lines.append(line)
|
||||||
|
Loading…
Reference in New Issue
Block a user