[Tkinter-discuss] Inserting a unicode zero-width nonbreaking space into a Text widget, from Tkinter, on a Mac

Kenneth McDonald kmmcdonald at wisc.edu
Wed Mar 24 18:40:25 EST 2004

As the subject says, I am attempting to insert a particular unicode 
(\ufeff) into a Text widget, from Python. This is not quite working 
and I'm not sure if the problem is between Python and Tcl, or is a 
problem of
OS X not properly knowing the character.

This character is supposed to be a 0-width space, and using Python's
unicodedata.name function confirms that feff is in fact the proper 
sequence.  The character is construction using a one-character python

	zws = u"\ufeff"

And then passed to Text's insert command. Unfortunately, what shows
up on screen is a complex (perhaps Chinese) asian ideograph.
"Python in a Nutshell" indicates that all communication between
Tkinter and Tk is in unicode, so I had hoped this would transfer

Not sure if I need to do some conversion or not...could there be
a conflict between a straight Unicode (16-bit) representation
and a UTF-8 representation? Or do I need to do an OS setting
to make sure the OS and the internal representation are on
the same wavelength?


More information about the Tkinter-discuss mailing list