Set locale in daemon and tool

This is necessary to properly show non-UTF8 strings in debug mode (for the
daemon) and upower --dump etc. (for the tool).
This commit is contained in:
Shih-Yuan Lee (FourDollars) 2013-09-03 21:16:59 +08:00 committed by Martin Pitt
parent 347b8b0b93
commit fdc62ad245
2 changed files with 4 additions and 0 deletions

View file

@ -32,6 +32,7 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <glib-object.h>
#include <locale.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
@ -207,6 +208,7 @@ main (gint argc, gchar **argv)
#if !defined(GLIB_VERSION_2_36)
g_type_init ();
#endif
setlocale(LC_ALL, "");
context = g_option_context_new ("upower daemon");
g_option_context_add_main_entries (context, options, NULL);

View file

@ -30,6 +30,7 @@
#include <sys/time.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <locale.h>
#include "up-client.h"
#include "up-device.h"
@ -281,6 +282,7 @@ main (int argc, char **argv)
#if !defined(GLIB_VERSION_2_36)
g_type_init ();
#endif
setlocale(LC_ALL, "");
context = g_option_context_new ("UPower tool");
g_option_context_add_main_entries (context, entries, NULL);