As I have found from other questions here on StackOverflow (see here) there is a bug in Tkinter when using Unicode for emojis.
I have implemented the function that fixes the displaying of Unicode so I can display emojis just fine using Tkinter. However, Tkinter still throws an exception when I try to get text from an entry (text box) widget that contains an emoji saying that it is unable to decode the utf-8 string.
I suspect I might be able to get around this using tk.call
to access the underlying Tcl interpreter directly since the other question makes me think the bug is in Tkinter and not Tcl. I do not know any Tcl have have failed to find any documentation on how to use tk.call
... Am I going down the right path or is there a better solution?
Here is the stack trace for the crash:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files (x86)\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:/Users/phili/PycharmProjects/pychat\gui.py", line 61, in __send
self.add_message('You: ' + replace_emoji(self.__msg_entry.get()))
File "C:\Program Files (x86)\Python37-32\lib\tkinter\__init__.py", line 2682, in get
return self.tk.call(self._w, 'get')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 0: invalid continuation byte