From 158564e79a5f16b6b25eed43a768c8fb0c7fcd33 Mon Sep 17 00:00:00 2001 From: scito Date: Tue, 27 Dec 2022 00:18:37 +0100 Subject: [PATCH] fix to_bytes() mandatory byte_order --- utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.py b/utils.py index ddcf313..19cb52c 100644 --- a/utils.py +++ b/utils.py @@ -114,7 +114,7 @@ def replace_escaped_octal_utf8_bytes_with_str(str): for encoded_name_string in encoded_name_strings: escaped_bytes = re.findall(r'((?:\\[0-9]+)+)', encoded_name_string) for byte_sequence in escaped_bytes: - unicode_str = b''.join([int(byte, 8).to_bytes(1) for byte in byte_sequence.split('\\') if byte]).decode('utf-8') + unicode_str = b''.join([int(byte, 8).to_bytes(1, 'little') for byte in byte_sequence.split('\\') if byte]).decode('utf-8') print("Replace '{}' by '{}'".format(byte_sequence, unicode_str)) str = str.replace(byte_sequence, unicode_str) return str