diff options
Diffstat (limited to 'python/databuffer.py')
| -rw-r--r-- | python/databuffer.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/python/databuffer.py b/python/databuffer.py index a54a6cc0..55b0f782 100644 --- a/python/databuffer.py +++ b/python/databuffer.py @@ -128,7 +128,10 @@ class DataBuffer: data = core.BNGetDataBufferContents(self.handle) assert data is not None, "core.BNGetDataBufferContents returned None" ctypes.memmove(buf, data, len(self)) - return buf.raw.decode('utf8') + try: + return buf.raw.decode('utf8') + except UnicodeDecodeError: + return buf.raw.decode('charmap') def __bytes__(self): buf = ctypes.create_string_buffer(len(self)) |
