Tue, 10 Oct 2023 14:53:23 +0200
MicroPython interface
- Corrected the MicroPython REPL widget to be able to deal with unicode output.
src/eric7/MicroPython/MicroPythonReplWidget.py | file | annotate | diff | comparison | revisions |
--- a/src/eric7/MicroPython/MicroPythonReplWidget.py Mon Oct 09 19:48:41 2023 +0200 +++ b/src/eric7/MicroPython/MicroPythonReplWidget.py Tue Oct 10 14:53:23 2023 +0200 @@ -567,7 +567,18 @@ else: tc.deleteChar() self.setTextCursor(tc) - self.insertPlainText(chr(data[index])) + # unicode handling + if data[index] & 0b11110000 == 0b11110000: + length = 4 + elif data[index] & 0b11100000 == 0b11100000: + length = 3 + elif data[index] & 0b11000000 == 0b11000000: + length = 2 + else: + length = 1 + txt = data[index:index + length].decode("utf8") + index += length - 1 # one more is done at the end + self.insertPlainText(txt) index += 1