platformio-vscode-ide: Serial monitor UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 0: ordinal not in range(128)
When I open the Visual studio code serial monitor I get this error: UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\ufffd’ in position 0: ordinal not in range(128)
Works fine in the Arduino IDE Serial Monitor with the same baud rate.
MacOS with Python 2.7 $LANG en_GB.UTF-8
--- Miniterm on /dev/cu.usbserial-DN01J4DW 115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Exception in thread rx:
Traceback (most recent call last):
File "/usr/local/var/pyenv/versions/2.7/lib/python2.7/threading.py", line 530, in __bootstrap_inner
self.run()
File "/usr/local/var/pyenv/versions/2.7/lib/python2.7/threading.py", line 483, in run
self.__target(*self.__args, **self.__kwargs)
File "/Users/chris/.platformio/penv/lib/python2.7/site-packages/serial/tools/miniterm.py", line 453, in reader
self.console.write(text)
File "/Users/chris/.platformio/penv/lib/python2.7/site-packages/serial/tools/miniterm.py", line 68, in write
self.output.write(text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 0: ordinal not in range(128)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (2 by maintainers)
I had to patch write method to make utf-8 chars and invalid chars prevent this crash:
This issue eventually went away, from memory I had to uninstall all other installs of platform-io. eg from cli using npm install etc. and only end up with the VSC one.