src/eric7/MicroPython/MicroPythonReplWidget.py

branch
eric7
changeset 10234
6b6fe61bba38
parent 10030
512d8ecbfdab
child 10255
a25f95af0a51
diff -r 51a6649ba79d -r 6b6fe61bba38 src/eric7/MicroPython/MicroPythonReplWidget.py
--- 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
 

eric ide

mercurial