From 5609a171fa5b3d33e345e48d6fd81b9e4e06b76a Mon Sep 17 00:00:00 2001 From: Guy Dupont Date: Mon, 11 Sep 2023 14:38:07 -0400 Subject: [PATCH] Use better supported method for decoding bytearray to string --- code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code.py b/code.py index 948a282..6980c12 100644 --- a/code.py +++ b/code.py @@ -56,7 +56,7 @@ message_bytes = struct.unpack_from(TINY_CODE_READER_MESSAGE_FORMAT, read_data, TINY_CODE_READER_MESSAGE_OFFSET) if message_length > 0: - message_string = bytearray(message_bytes)[0:message_length].decode("utf-8") + message_string = str(bytearray(message_bytes[:message_length]), 'utf-8') is_same = (message_string == last_message_string) last_message_string = message_string current_time = time.monotonic()