Bug 65866 - utf-8 output needed for widgets
Summary: utf-8 output needed for widgets
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux Beta
Classification: Retired
Component: libglade2
Version: beta1
Hardware: All
OS: Linux
high
medium
Target Milestone: ---
Assignee: Havoc Pennington
QA Contact:
URL:
Whiteboard:
Depends On: 72693
Blocks: 67217 68332 68939 68949 69208
TreeView+ depends on / blocked
 
Reported: 2002-06-03 11:49 UTC by Harald Hoyer
Modified: 2008-05-01 15:38 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-07-21 03:47:31 UTC
Embargoed:


Attachments (Terms of Use)

Description Harald Hoyer 2002-06-03 11:49:00 UTC
Description of Problem:
Reading glade files with translatable strings results in:
*** Invalid UTF8 string passed to pango_layout_set_text()
and broken strings

Version-Release number of selected component (if applicable):
libglade2-1.99.12-4

How Reproducible:

Steps to Reproduce:
1. install e.g. redhat-config-network-1.1.0
2. sudo LANG=de_DE /usr/sbin/neat

Actual Results:
wrong strings passed to set_text()

Solution:
add to glade_parser_parse_buffer() and glade_parser_parse_file():
    bind_textdomain_codeset(state.domain, "UTF-8");

Comment 1 Havoc Pennington 2002-06-03 12:57:47 UTC
See http://bugzilla.gnome.org/show_bug.cgi?id=83969

Comment 2 Harald Hoyer 2002-06-03 13:24:24 UTC
./gtk/libglade.override:_wrap_glade_bindtextdomain()
...
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
    bind_textdomain_codeset(domainname, "UTF-8");
#endif
..

maybe the gtk.glade.XML constructor should have that, too...

Comment 3 James Henstridge 2002-06-03 14:14:33 UTC
My comments from GNOME bugzilla:

It is the application's responsibility to set up its translation
domains.  Libglade simply makes use of the translation domains set up
by the application.  People don't expect gtk_init() to fool around
with their domains, I wouldn't have thought they would expect libglade
to either.

The gtk.glade.bindtextdomain() function is included in the python
bindings because there is no wrapper for it in the standard library
(the gettext module in python does not call into the C gettext lib).

In python 2.3, apparently there will be a locale.bindtextdomain()
function to do the work (I don't know if it will handle the codeset
part though -- might be worth checking).

Comment 4 Harald Hoyer 2002-06-03 14:53:34 UTC
since there is no python binding for bind_textdomain_codeset(), this is very
complicated...

Comment 5 James Henstridge 2002-06-03 15:05:31 UTC
Well, the gtk.glade.bindtextdomain() function won't go away, and does call
bind_textdomain_codeset() for you.

Comment 6 Harald Hoyer 2002-06-03 15:07:37 UTC
workarounds, workarounds... without bind_textdomain_codeset(domainname,
"UTF-8"); the whole glade i18n is useless with gtk2 widgets...

Comment 7 James Henstridge 2002-06-03 15:35:10 UTC
Without bind_textdomain_codeset(), any gtk2 program will have issues.  If this
is an issue at all, then it is with gtk 2.0, or gettext.

Comment 8 Havoc Pennington 2002-07-07 02:54:57 UTC
Has this been resolved in some way? I'm not sure I understand what the 
issue is or if one remains. Our config tools work right?

Comment 9 Owen Taylor 2002-07-07 15:28:09 UTC
I don't fully understand the problem here; if the Python libglade
bindings have gtk.glade.bindtextdomain(), they should have
gtk.glade.bindtextdomain_codeset() as well. The situation seems very
parallel. *Someone* needs to call the C gettext function, since
liglade is using the C gettext. Or libglade needs to provide
a hook to subsitute a different translation function.

We typically run in a UTF-8 locale and use UTF-8 .po files, so
most of the time we won't see this problem. But for CJK locales
we aren't using UTF-8 currently....

Comment 10 James Henstridge 2002-07-08 02:25:36 UTC
The gtk.glade.bindtextdomain() function was added to work around the lack of
such a function in the standard python library (which should be addressed in
Python 2.3).

We added gtk.glade.bindtextdomain() as a convenient way for Python programmers
to set up a translation domain for use with libglade.  As libglade requires that
the translation domain return UTF-8 strings, it calls bind_textdomain_codeset()
for you (if it is available).

However, the glade_xml_new() constructor does not call
bind_textdomain_codeset(), as it simply _uses_ a translation domain that has
already been set up.

From what I can tell, there is no bug here.  Libglade expects you to pass in a
translation domain that returns UTF-8 strings.  We provide a function to set up
a translation domain with its codeset set to UTF-8.  If I am missing something,
please provide some more information.

Comment 11 Aleksey Nogin 2002-07-18 23:20:00 UTC
In Limbo, I get a huge number of

** (up2date:7550): WARNING **: Invalid UTF8 string passed to pango_layout_set_text()

when running with ru_RU.KOI8-R and a huge number of

** (up2date:7728): WARNING **: Invalid UTF8 string passed to pango_layout_set_text()

when running with ru_RU.UTF-8. in both cases it seems that many places whene
some text is supposed to be are just shown blank!

Comment 12 Havoc Pennington 2002-07-22 00:07:07 UTC
From the discussion people seem to be saying this is a bug in the apps, not
libglade.

Comment 13 Daniel Walsh 2002-08-26 18:20:16 UTC
No this is definitely a bug in lib glade check out 72693 for description.


Note You need to log in before you can comment on or make changes to this bug.