diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index a09ea09f9e..2016173855 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -1695,7 +1695,7 @@ def inspect_section( if ttype == 'text': try: - struct['text'] = data.decode() + struct['text'] = data.rstrip(b'\0').replace(b'\0', b'\\0').decode() except UnicodeDecodeError as e: print(f'Section {name!r} is not valid text: {e}', file=sys.stderr) struct['text'] = '(not valid UTF-8)'