Re: GTK on Linux and UTF-8 text



On Tue, May 04, 2010 at 02:01:45PM +0200, Andreas Falkenhahn wrote:
> I previously worked with GTK only on Windows and the Windows builds of GTK
> always used UTF-8 for everything. Now I played a bit with GTK on Linux and
> noticed that it doesn't seem to handle UTF-8 correctly by default.
> Instead, ISO 8859-1 is used (which should be my locale's default charset).
> When I pass UTF-8 text to functions like gtk_dialog_add_button(), then the
> specified strings seem to be treated as ISO-8859-1, i.e. non ASCII
> characters appear as multiple characters instead of being resolved to the
> single character they represent according to UTF-8 decoding tables.
> 
> Could someone tell me how I can convince GTK to use UTF-8 as the default
> on Linux, too?

Gtk+ uses UTF-8 everywhere for everything[*] so I am almost sure that
you do not pass UTF-8 even if you think so.  Most likely your strings
were double-encoded to UTF-8.

[*] The only exception are functions working with file names that might
to be in on-disk encoding, or something else, see

http://library.gnome.org/devel/glib/stable/glib-Character-Set-Conversion.html
http://library.gnome.org/devel/gtk/stable/GtkFileChooser.html#gtkfilechooser-encodings
etc.

Yeti



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]