Prechádzať zdrojové kódy

tools: handle exception in case of logging Unicode characters

Juraj Michálek 5 rokov pred
rodič
commit
f60c8c8164
1 zmenil súbory, kde vykonal 3 pridanie a 0 odobranie
  1. 3 0
      tools/idf_monitor.py

+ 3 - 0
tools/idf_monitor.py

@@ -920,6 +920,9 @@ if os.name == 'nt':
                 # Also possible for Windows to throw an OSError error if the data is invalid for the console
                 # (garbage bytes, etc)
                 pass
+            except UnicodeDecodeError:
+                # In case of double byte Unicode characters display '?'
+                self.output.write('?')
 
         def write(self, data):
             if isinstance(data, bytes):