Re: gtk_label_set_text misbehavior ?



Eric GAUDET <egaudet intalio com> writes: 
> I think this is not the correct behavior and that gtk should use the (1-byte
> chars) string in case gdk_mbstowcs fails.
> 
> What do you think?
> 

GTK takes strings in the encoding of the current locale. If you give
it anything else, then your code is broken; it won't work in all
locales.

Your code works on Red Hat because the locale happens to be en_US or
the like which uses Latin-1; on Debian in the "C" locale the encoding
is ASCII, Latin-1 is not allowed.

If you are hardcoding Latin-1 strings into your app, then you require
a Latin-1 locale to run and work. It's that simple. Even if by some
bad hack we could make it work in ASCII, it would be totally broken in
every other non-Latin-1 locale.

The usual way to solve this problem - make strings match the locale -
is to translate them with gettext.

GTK 2 will require every string to be in UTF-8. Also, Red Hat will
probably move to all locales using the UTF-8 encoding at some point,
so Latin-1 will not work even in en_US or fr_FR. Point being, in the
future hardcoded Latin-1 strings won't work even in the locales that
are currently Latin-1.

Havoc




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