[issue39126] Non-bmp (astral) unicode characters confuse the editor

Terry J. Reedy report at bugs.python.org
Mon Dec 23 17:22:38 EST 2019


Terry J. Reedy <tjreedy at udel.edu> added the comment:

I am aware of this.  Before the recent (Oct 4) fix for #13153, pasting an astral character into an edit line or window crashed IDLE.  After the fix, the character appears (and printing such chars also works reliably).  But astral chars confuse the tk text widget, which cannot properly handle them. (I believe that they are stored as 2 surrogate chars, displayed as one.)

I don't want to immediately replace such chars with escape sequences.

>>> hex(ord('😆'))
'0x1f606'
>>> '\U0001f606'
'😆'

The effect is limited to the line containing the odd char, and once entered, strange cursor placement does not matter too much.  But we probably should document the situation and add an option to escape or unescape such chars.

----------
title: Some characters confuse the editor -> Non-bmp (astral) unicode characters confuse the editor
versions: +Python 3.9 -Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39126>
_______________________________________


More information about the Python-bugs-list mailing list