On Mon, Nov 09, 2009 at 08:33:02PM -0800, Matt Kraai wrote: > On Mon, Nov 09, 2009 at 11:55:57PM +0100, Josselin Mouette wrote: > > Le samedi 07 novembre 2009 à 13:32 -0800, Matt Kraai a écrit : > > > On my system, alacarte has a segmentation fault if I reconfigure the > > > locales package to generate the it...@euro locale and set LANG to > > > "it...@euro". > > > > > > While it's parsing the UI definition, it translates "Restore the > > > default menu layout" to "Ripristina la struttura predefinita del > > > men�", which uses the ISO/IEC 8859-15 character set. It subsequently > > > calls g_markup_escape_text on this string, which expects it to use > > > UTF-8. This causes it to miss the end of the string and, eventually, > > > to try to access an inaccessible page, causing the segmentation fault. > > > > > > I don't know where or how this should be fixed. > > > > There is probably a missing bind_textdomain_codeset call, or whatever > > the equivalent is in Python. > > Python's gettext module provides a bind_textdomain_codeset call, but > adding > > gettext.bind_textdomain_codeset(config.GETTEXT_PACKAGE,'UTF-8') > > and prefixing GETTEXT_PACKAGE on the previous two lines with "config." > doesn't eliminate the segmentation fault.
bind_textdomain_codeset is also provided by the locale module. When that version is used, the application does not have a segmentation fault. I've attached the patch. Would it be OK to perform an NMU? -- Matt http://ftbfs.org/kraai
diff -Nur -x '*.orig' -x '*~' alacarte-0.12.4/Alacarte/MainWindow.py alacarte-0.12.4.new/Alacarte/MainWindow.py --- alacarte-0.12.4/Alacarte/MainWindow.py 2009-09-08 07:24:13.000000000 -0700 +++ alacarte-0.12.4.new/Alacarte/MainWindow.py 2009-11-10 04:58:47.000000000 -0800 @@ -18,13 +18,14 @@ import gtk, gmenu, gobject, gio import cgi, os -import gettext +import gettext, locale import subprocess import urllib try: from Alacarte import config - gettext.bindtextdomain(GETTEXT_PACKAGE,config.localedir) - gettext.textdomain(GETTEXT_PACKAGE) + gettext.bindtextdomain(config.GETTEXT_PACKAGE,config.localedir) + gettext.textdomain(config.GETTEXT_PACKAGE) + locale.bind_textdomain_codeset(config.GETTEXT_PACKAGE,'UTF-8') except: pass _ = gettext.gettext