On Mon, 20 Nov 2000, Tessa Lau wrote:

> 
> What's the status on Unicode support in Gtk and the Python wrappers?
> I tried using insert_defaults to insert a string containing some Unicode
> characters into a GtkText widget, and I saw a different set of characters
> than I expected.

gtk 1.2 doesn't do unicode, so I haven't done any work to add unicode
support to the 1.2 version of pygtk.

However, you should be able to pass unicode strings into just about all
pygtk functions, and they will be converted to the default encoding.  By
default in python 2.0, this is ASCII, so anything other than 7-bit ascii
will give an exception during this conversion.

You can modify this to whatever the default encoding for your system
really is by changing site.py to set the appropriate encoding.  By doing
this, if your default encoding is latin1 for instance, unicode strings
consisting entirely of latin1 code points can be passed as arguments to
pygtk without error.  This is about the extent that unicode can be
supported with gtk 1.2.

In pygtk for gtk 2.0, importing the gtk module automatically changes the
default encoding to UTF8, as that is what gtk expects.  This means that
you can pass in arbitrary unicode strings and have them display correctly
(provided that the required fonts are available and Pango has shapers for
that region of unicode).

James.


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to