r23766 - gnucash/trunk/src/bin - Add some debug output to help in debugging locale problems
Geert Janssens
gjanssens at code.gnucash.org
Sat Jan 25 08:33:42 EST 2014
Author: gjanssens
Date: 2014-01-25 08:33:42 -0500 (Sat, 25 Jan 2014)
New Revision: 23766
Trac: http://svn.gnucash.org/trac/changeset/23766
Modified:
gnucash/trunk/src/bin/gnucash-bin.c
Log:
Add some debug output to help in debugging locale problems
This is skipped on OS X because that has its own routine to deal with locales
Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c 2014-01-25 11:50:43 UTC (rev 23765)
+++ gnucash/trunk/src/bin/gnucash-bin.c 2014-01-25 13:33:42 UTC (rev 23766)
@@ -687,6 +687,7 @@
int
main(int argc, char ** argv)
{
+ gchar *sys_locale = NULL;
#if !defined(G_THREADS_ENABLED) || defined(G_THREADS_IMPL_NONE)
# error "No GLib thread implementation available!"
#endif
@@ -713,12 +714,13 @@
#endif
gnc_environment_setup();
#ifndef MAC_INTEGRATION /* setlocale already done */
- if (!setlocale (LC_ALL, ""))
+ sys_locale = g_strdup (setlocale (LC_ALL, ""));
+ if (!sys_locale)
{
- g_print ("The locale defined in the environment isn't supported. "
- "Falling back to the 'C' (US English) locale\n");
- g_setenv ("LC_ALL", "C", TRUE);
- setlocale (LC_ALL, "C");
+ g_print ("The locale defined in the environment isn't supported. "
+ "Falling back to the 'C' (US English) locale\n");
+ g_setenv ("LC_ALL", "C", TRUE);
+ setlocale (LC_ALL, "C");
}
#endif
#ifdef HAVE_GETTEXT
@@ -736,6 +738,15 @@
gnc_log_init();
+#ifndef MAC_INTEGRATION
+ /* Write some locale details to the log to simplify debugging
+ * To be on the safe side, only do this if not on OS X,
+ * to avoid unintentionally messing up the locale settings */
+ PINFO ("System locale returned %s", sys_locale ? sys_locale : "(null)");
+ PINFO ("Effective locale set to %s.", setlocale (LC_ALL, ""));
+ g_free (sys_locale);
+#endif
+
/* If asked via a command line parameter, fetch quotes only */
if (add_quotes_file)
{
More information about the gnucash-changes
mailing list