mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Call setlocale(LC_ALL, "") exactly once.
And in Windows only with the value from the environment if there is one. Calling it with "" in Windows ignores the environment and sets it to the system settings.
This commit is contained in:
parent
d30cf25c45
commit
529a6cb067
@ -102,7 +102,7 @@ static const char *add_quotes_file = NULL;
|
||||
static char *namespace_regexp = NULL;
|
||||
static const char *file_to_load = NULL;
|
||||
static gchar **args_remaining = NULL;
|
||||
static gchar *sys_locale = NULL;
|
||||
static gchar *sys_locale = NULL;
|
||||
|
||||
static GOptionEntry options[] =
|
||||
{
|
||||
@ -617,23 +617,7 @@ inner_main (void *closure, int argc, char **argv)
|
||||
|
||||
main_mod = scm_c_resolve_module("gnucash utilities");
|
||||
scm_set_current_module(main_mod);
|
||||
#ifdef __MINGW32__
|
||||
/* Guile initialization calls setlocale(LC_ALL, "") which on
|
||||
* windows resets the locale to what the user has set in the
|
||||
* registry. Put it back to what we set from the environment or
|
||||
* environment file.
|
||||
*/
|
||||
if (sys_locale)
|
||||
{
|
||||
setlocale (LC_ALL, sys_locale);
|
||||
g_free (sys_locale);
|
||||
sys_locale = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
setlocale (LC_ALL, "C");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check whether the settings need a version update */
|
||||
gnc_gsettings_version_upgrade ();
|
||||
|
||||
@ -927,12 +911,9 @@ main(int argc, char ** argv)
|
||||
* 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, ""));
|
||||
#ifndef __MINGW32__
|
||||
/* We need it for later on Windows, see inner_main(). */
|
||||
PINFO ("Effective locale set to %s.", setlocale (LC_ALL, NULL));
|
||||
g_free (sys_locale);
|
||||
sys_locale = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If asked via a command line parameter, fetch quotes only */
|
||||
|
@ -50,12 +50,6 @@
|
||||
(read-enable 'positions)
|
||||
(debug-set! stack 200000)
|
||||
|
||||
;; Initalialize localization, otherwise reports may output
|
||||
;; invalid characters
|
||||
(setlocale LC_ALL "")
|
||||
|
||||
;;;; Status output functions.
|
||||
|
||||
(define (strify items)
|
||||
(string-join (map (lambda (x) (format #f "~A" x)) items) ""))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user