Re: glade localization woes



On Tue, Jun 15, 2004 at 15:12:21 -0300, "Cristóv?o B. B. Dalla Costa" wrote:
Hello

In the app I'm programming, with localization support, we use libglade. 
For a while now we've been plagued by a gettext problem in which some 
messages would appear with garbage in place of accented letters.

Today we finally traced the problem down.

Glade requires the program's to set it's locale to *.UTF-8 otherwise 
it'll spew all kinds of garbage. However, when a widget's label is set 
from the program (not via glade) it will produce the erroneous output I 
described previously.

I'm posting this here because we've worked on Gtk2 programs written in C 
and Python and only those written in Perl show this behaviour, so I 
think it might be a gtk-perl bug.

A temporary solution is to use Unicode::MapUTF8 to convert localized 
strings back to ISO-8859-1 before using them in Gtk widgets, but that's 
ugly and cumbersome:

my $dlg = Gtk2::MessageDialog->new (undef, "destroy-with-parent", 
"info", "close",
        from_utf8 ({ -string => gettext ($msg), -charset => 
'ISO-8859-1'}));

It seems that there is a bug in gettext. Perl has two types of strings
-- octet streams and unicode. It's a mess, sometimes. Read the
perlunicode manpage to find more about it. Now what really should be
done is forcing gettext to mark the string as unicode one if it is one.

Is it anything I'm doing wrong, or is it a Perl Glade bug (which is what 
I'm inclined to believe)?

No. It's a gettext bug. It returns unicode string, but does not mark it
as such. And all the glib-perl/gtk2-perl/gtk2-glade-perl stuff honors
that marks.

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <bulb ucw cz>

Attachment: signature.asc
Description: Digital signature



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