[Tkinter-discuss] Inserting a unicode zero-width nonbreaking
space into a Text widget, from Tkinter, on a Mac
Jeff Epler
jepler at unpythonic.net
Wed Mar 24 22:54:37 EST 2004
In *theory*,
# t = Tkinter.Text()
t.insert(Tkinter.END, u"a\ufeffb")
should work just fine. However, I doubt Tk's text engine has enough
advanced text layout to respond appropriately to a zero-width
nonbreaking space. (heck, I just learned my mozilla doesn't properly
render \u200b, a breaking zero-width space)
Anyway, Tk has some complicated machinery to look through a number of
operating system fonts in various encodings to find a font where the
encoding of the character maps onto an existing glyph. When this fails,
it shows a placeholder (empty rectangle---what I got in my test, on
a Linux system) or an \xXXXX escape code. If it shows an incorrect
character, I'd be tempted to blame either a font with a character
that u"\ufeff" (erroneously) encodes to, or a bad Tcl encoding that
(erroneously) encodes u'\ufeff' to the wrong thing. It doesn't make
things easier that Tcl has its own encoding machinery and list of fonts
to try.
Jeff
More information about the Tkinter-discuss
mailing list