From fdc62ad245eb76c337cea2abbbeaca7ddf7c60eb Mon Sep 17 00:00:00 2001 From: "Shih-Yuan Lee (FourDollars)" Date: Tue, 3 Sep 2013 21:16:59 +0800 Subject: [PATCH] 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). --- src/up-main.c | 2 ++ tools/up-tool.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/up-main.c b/src/up-main.c index a7e6eb6..ba79685 100644 --- a/src/up-main.c +++ b/src/up-main.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -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); diff --git a/tools/up-tool.c b/tools/up-tool.c index c82dae4..ad4015e 100644 --- a/tools/up-tool.c +++ b/tools/up-tool.c @@ -30,6 +30,7 @@ #include #include #include +#include #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);