[PATCH] linux: Add UTF-8 encoding support.

Shih-Yuan Lee (FourDollars) fourdollars at gmail.com
Tue Sep 3 02:44:16 PDT 2013


From: "Shih-Yuan Lee (FourDollars)" <sylee at canonical.com>

---
 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..6706053 100644
--- a/src/up-main.c
+++ b/src/up-main.c
@@ -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, "en_US.utf8");
 
 	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..3cee06b 100644
--- a/tools/up-tool.c
+++ b/tools/up-tool.c
@@ -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, "en_US.utf8");
 
 	context = g_option_context_new ("UPower tool");
 	g_option_context_add_main_entries (context, entries, NULL);
-- 
1.7.9.5



More information about the devkit-devel mailing list