From 58340fc0a063fbc54c0ea079fadac7d639059f7d Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Thu, 9 Apr 2015 21:21:43 -0400 Subject: [PATCH] Fix UTF issues --- pwndbg/hexdump.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pwndbg/hexdump.py b/pwndbg/hexdump.py index baf087858..42ec18702 100644 --- a/pwndbg/hexdump.py +++ b/pwndbg/hexdump.py @@ -15,7 +15,7 @@ def groupby(array, count, fill=None): # color_scheme = {i:pwndbg.color.normal("%02x" % i) for i in range(256)} -for c in bytearray((string.ascii_letters + string.digits + string.punctuation).encode('utf-8')): +for c in bytearray((string.ascii_letters + string.digits + string.punctuation).encode('utf-8', 'ignore')): color_scheme[c] = pwndbg.color.bold("%02x" % c) for c in bytearray(b'\x00\xff'): @@ -27,7 +27,7 @@ color_scheme[-1] = ' ' # Only print out printable values on the righ hand side # printable = {i:'.' for i in range(256)} -for c in bytearray((string.ascii_letters + string.digits + string.punctuation).encode('utf-8')): +for c in bytearray((string.ascii_letters + string.digits + string.punctuation).encode('utf-8', 'ignore')): printable[c] = chr(c) printable[-1] = ' '