Просмотр исходного кода

tools: handle exception in case of logging Unicode characters

Juraj Michálek 5 лет назад
Родитель
Сommit
3d83ce6d7a
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      tools/idf_monitor.py

+ 3 - 0
tools/idf_monitor.py

@@ -824,6 +824,9 @@ if os.name == 'nt':
                 # an exception (however, the character is still written to the screen)
                 # Ref https://github.com/espressif/esp-idf/issues/1136
                 pass
+            except UnicodeDecodeError:
+                # In case of double byte Unicode characters display '?'
+                self.output.write('?')
 
         def write(self, data):
             if isinstance(data, bytes):