From 7d64dc9c7464582a28041346fb57f29260480da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Fri, 16 Jun 2023 04:20:07 +0200 Subject: [PATCH] fixed UnicodeDecodeError occurring during file name parsing (#118) --- uefi_firmware/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uefi_firmware/base.py b/uefi_firmware/base.py index be6c4eb..6430d35 100644 --- a/uefi_firmware/base.py +++ b/uefi_firmware/base.py @@ -27,7 +27,10 @@ def name(self): @name.setter def name(self, name): if isinstance(name, bytes): - name = name.decode("utf-8") + try: + name = name.decode("utf-8") + except UnicodeDecodeError: + name = "0x[{}]".format(name.hex()) self._name = name @property