GNOME Bugzilla – Bug 608425
Can't start in non UTF-8 locale
Last modified: 2010-04-07 13:46:22 UTC
[pterjan@plop ~]$ glchess /usr/lib/python2.6/site-packages/glchess/gtkui/gtkui.py:42: GtkWarning: Invalid input string ui.add_from_file(os.path.join(UI_DIR, name)) It works fine is started as LC_ALL=fr_FR.UTF-8 glchess
Created attachment 152598 [details] [review] Patch avoiding the crash
Hi Pascal, I can't reproduce the problem but is it solved by adding gettext.bind_textdomain_codeset(DOMAIN, LOCALEDIR) to src/lib/defaults.py.in instead?
No it would not, gettext module will change it for python implementation of gettext, while it needs to be done for the C version. I had already faced this issue and commented on https://bugzilla.gnome.org/show_bug.cgi?id=589090#c4 I found the solution in python doc, at the boftom of http://docs.python.org/library/locale.html ===== The locale module exposes the C library’s gettext interface on systems that provide this interface. It consists of the functions gettext(), dgettext(), dcgettext(), textdomain(), bindtextdomain(), and bind_textdomain_codeset(). These are similar to the same functions in the gettext module, but use the C library’s binary format for message catalogs, and the C library’s search algorithms for locating message catalogs. Python applications should normally find no need to invoke these functions, and should use gettext instead. A known exception to this rule are applications that link use additional C libraries which internally invoke gettext() or dcgettext(). For these applications, it may be necessary to bind the text domain, so that the libraries can properly locate their message catalogs. =====
I think bug 589090 is for glibc mo files. I think almost GNOME .po has the following line in the header: "Content-Type: text/plain; charset=UTF-8\n" So probably it's no problem when fr_FR.ISO8859-1 .po has the UTF-8 encoding without bind_textdomain_codeset().
(In reply to comment #4) > So probably it's no problem when fr_FR.ISO8859-1 .po has the UTF-8 encoding > without bind_textdomain_codeset(). Sorry, I confirmed bind_textdomain_codeset() is needed in this bug.
Any news ? This is sad that 2.30 still has this major bug for people not in UTF-8 locale...
Sorry, this got forgotten about. I've fixed it now, please check if it works. The reason I didn't take the patch immediately: - There were no instructions on how to reproduce, I think this would have done it? $ LC_ALL=fr_FR.ISO8859-1 glchess - The patch set the locale a long way after the start of the application. I've applied it in defaults.py where the other locale settings are done at program initialization. Thanks!
http://git.gnome.org/browse/gnome-games/commit/?id=9539c28613c047a31fb0fe56521a9b98f122ebec