New submission from Ronald Oussoren <ronaldousso...@mac.com>: As mentioned in msg380552: I get an SyntaxError with message "utf-8' codec can't encode characters in position 7-12: surrogates not allowed." when I paste a smiley emoji in an IDLE interactive shell and try to execute that line, for example using:
>>> print("😀") The error is likely due to a surrogate pair being present in the UTF-8 representation of a Tcl/Tk string. It should be possible to work around this in _tkinter.c:unicodeFromTclStringAndSize by merging surrogate pairs. This is with: - Python 3.10 - macOS 11 (arm64) - Tk 8.6.10 With Tk 8.6.8 (as included in the macOS installers on python.org) printing won't work at all, as mentioned in bpo-42225. ---------- components: Tkinter, macOS messages: 380715 nosy: ned.deily, ronaldoussoren priority: normal severity: normal stage: needs patch status: open title: [tkinter] surrogate pairs in Tcl/Tk string when pasting an emoji in a text widget type: behavior _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42318> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com