Hi,

On Mon, 21 Jan 2019 13:00:52 -0500
Ben <bc...@speedymail.org> wrote:

(...)
> Thanks so much for your replies!
>
> Here's my little test script, with trying what you wrote, and the
> results I got (all on python 3): import tkinter as tk
> from tkinter import ttk
> root = tk.Tk()
> l = ttk.Label(root)
> l.grid(row=0, column=0)
> text = 'Test \U0001d306 String'
>
> #l.configure(text=text)
> #  Result: _tkinter.TclError: character U+1d306 is above the range (U
> # +0000-U+FFFF) allowed by Tcl
>
> #l.configure(text=text.encode('utf8'))
> #  Result: no exception, but wrong characters show up
>
> l.tk.eval(l._w + f' configure -text  "{text}"')
> #  Result: works!

the same here.

> So, tkinter maintainers, would there be a way to build this into
> tkinter, so it transparently handles all unicode characters?

I tried to investigate a bit further and found this thread which seems
to more or less address this issue:

https://bugs.python.org/issue13153

It looks like the Tkinter maintainers are waiting for Tk 9.0 to come to
life which is supposed to introduce full unicode support.
There seem also to be some issues with different systems not behaving
exactly alike.

I also found a thread where a couple of workarounds are suggested:

https://stackoverflow.com/questions/40222971/python-find-equivalent-surrogate-pair-from-non-bmp-unicode-char

however none of these seem to work here 😞

> If so,
> would there be interest in patches for it?

Of course you can try.
Personally I would not bother (even if I had the skills to provide a
patch :)

Regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Lots of people drink from the wrong bottle sometimes.
                -- Edith Keeler, "The City on the Edge of Forever",
                   stardate unknown
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to