No subject


Fri Apr 8 00:08:22 EDT 2011


setlocale being called too late in our startup process.
(http://developer.gnome.org/glib/unstable/glib-Commandline-option-parser.html)
If this fix actually works, it could be a candidate for
BP

Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2011-04-09 10:23:21 UTC (rev 20545)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2011-04-09 13:28:10 UTC (rev 20546)
@@ -833,8 +833,6 @@
 #ifdef HAVE_GETTEXT
     {
         gchar *localedir = gnc_path_get_localedir();
-        /* setlocale(LC_ALL, ""); is already called by gtk_set_locale()
-           via gtk_init() -- except that it hasn't been called yet. */
         bindtextdomain(GETTEXT_PACKAGE, localedir);
         textdomain(GETTEXT_PACKAGE);
         bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
@@ -845,6 +843,13 @@
     qof_log_init();
     qof_log_set_default(QOF_LOG_INFO);
 
+    /* Note: setlocale will also be called later by gtk_init (which gets
+     * invoked by gnome_program_init), but that's too late. The locale
+     * must be properly set before parsing the command line arguments
+     * or filenames may be returned in a charset other than UTF-8 and
+     * not work with other glib calls.
+     */
+    setlocale(LC_ALL, "");
     gnucash_command_line(&argc, argv);
     gnc_print_unstable_message();
     gnc_log_init();



More information about the gnucash-changes mailing list