Mailing List Archive

Idle Python issue
Hello everybody,
I encounter a problem using Idle Python in Windows when I use utf8
characters longer than 2 bytes such as the character representing the
smile emoticon:
:-)
that is this:
????
Try to write this in Idle:
"????".encode('utf8')
b'\xf0\x9f\x98\x8a'
now try to write this:
"".encode('utf8')
now position the cursor between the double quotes and paste the smile
character and try to add some text to the string (eg: 'the smile').
You may notice problems with editing.
Is there any way to prevent this from happening? It is an annoying problem.
Thanks for your attention.

cheers
--
https://mail.python.org/mailman/listinfo/python-list
Re: Idle Python issue [ In reply to ]
On 2/24/2021 5:32 AM, jak wrote:
> Hello everybody,
> I encounter a problem using Idle Python in Windows when I use utf8
> characters longer than 2 bytes such as the character representing the
> smile emoticon:

The problem is with 'astral' unicode characters, those not in the Basic
Multilingual Plane (BMP). tcl/tk does not directly support them.

> :-)
> that is this:
> ????
> Try to write this in Idle:
> "????".encode('utf8')
> b'\xf0\x9f\x98\x8a'

Up until 1 1/2 years ago, you could not do this. Now you can, as long
as you do not try to edit anything after the astral character. I
thought I added something to the doc about this, but cannot find it, so
it should be easier to find.

> now try to write this:
> "".encode('utf8')
> now position the cursor between the double quotes and paste the smile
> character

Up until 1.5 years ago, this would have crashed either the window or
IDLE itself. For input, if one wants to edit, one is still better off
using \U000##### excapes. At least now print('\U00011111'), for
instance, works to display the character is the OS font system supports it.

> and try to add some text to the string (eg: 'the smile').
> You may notice problems with editing.
> Is there any way to prevent this from happening? It is an annoying problem.

Help the tcl/tk people to add full unicode support to tcl/tk. ;-) They
know it is needed. I don't know what their timetable is now.


--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list