Skip to content

Commit a92cadf

Browse files
committed
Make UTF-8 encoding explicit
1 parent 605bf76 commit a92cadf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mqterm/jobs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def _write_block(self, payload=None, payload_len=None):
236236

237237
def _validate_firmware(self):
238238
"""Validate the firmware file before finalizing the update."""
239-
hex_digest = hexlify(self.sha.digest()).decode()
239+
hex_digest = hexlify(self.sha.digest()).decode("utf-8")
240240
if not hex_digest == self.checksum:
241241
raise ValueError(
242242
f"Checksum mismatch: expected {self.checksum}, got {hex_digest}"

tests/e2e/e2e_file_ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def get_file(buffer: BytesIO):
8484
seq = 0
8585
props = format_properties("tty0", seq)
8686
await control_client.publish(
87-
"test/tty/in", "cat test.txt".encode(), properties=props
87+
"test/tty/in", "cat test.txt".encode('utf-8'), properties=props
8888
)
8989

9090
# Wait until the received buffer gets populated with the response
@@ -129,7 +129,7 @@ async def main():
129129
asyncio.create_task(device_handler())
130130

131131
bytes_sent = await send_file(buffer)
132-
logger.debug(f"Sent {bytes_sent.decode()} bytes to the device")
132+
logger.debug(f"Sent {bytes_sent.decode('utf-8')} bytes to the device")
133133
bytes_received = await get_file(buffer)
134134
logger.debug(f"Received {len(bytes_received)} bytes from the device")
135135

0 commit comments

Comments
 (0)