Sujet : Re: Decoding bytes to text strings in Python 2
De : python (at) *nospam* mrabarnett.plus.com (MRAB)
Groupes : comp.lang.pythonDate : 24. Jun 2024, 02:14:22
Autres entêtes
Message-ID : <mailman.163.1719188251.2909.python-list@python.org>
References : 1 2 3 4 5 6
User-Agent : Mozilla Thunderbird
On 2024-06-24 00:30, Chris Angelico via Python-list wrote:
On Mon, 24 Jun 2024 at 08:20, Rayner Lucas via Python-list
<python-list@python.org> wrote:
>
In article <mailman.159.1718991773.2909.python-list@python.org>,
rosuav@gmail.com says...
>
If you switch to a Linux system, it should work correctly, and you'll
be able to migrate the rest of the way onto Python 3. Once you achieve
that, you'll be able to operate on Windows or Linux equivalently,
since Python 3 solved this problem. At least, I *think* it will; my
current system has a Python 2 installed, but doesn't have tkinter
(because I never bothered to install it), and it's no longer available
from the upstream Debian repos, so I only tested it in the console.
But the decoding certainly worked.
>
Thank you for the idea of trying it on a Linux system. I did so, and my
example code generated the error:
>
_tkinter.TclError: character U+1f40d is above the range (U+0000-U+FFFF)
allowed by Tcl
>
So it looks like the problem is ultimately due to a limitation of
Tcl/Tk.
Yep, that seems to be the case. Not sure if that's still true on a
more recent Python, but it does look like you won't get astral
characters in tkinter on the one you're using.
[snip]
Tkinter in recent versions of Python can handle astral characters, at least back to Python 3.8, the oldest I have on my Windows PC.