From 276cba1103b60dbd62de721d398d9a93c75bdea4 Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Thu, 30 Aug 2018 13:33:11 +0200 Subject: [PATCH] idf_monitor: Fix Unicode decoding on Windows Closes https://github.com/espressif/esp-idf/issues/2348 --- tools/idf_monitor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/idf_monitor.py b/tools/idf_monitor.py index 38bfce980..f9eb2d1bd 100755 --- a/tools/idf_monitor.py +++ b/tools/idf_monitor.py @@ -733,8 +733,10 @@ if os.name == 'nt': pass def write(self, data): - if type(data) is not bytes: - data = data.encode('latin-1') + if isinstance(data, bytes): + data = bytearray(data) + else: + data = bytearray(data, 'utf-8') for b in data: b = bytes([b]) l = len(self.matched)