[packagekit] Unicode error with the yum backend
Richard Hughes
hughsient at gmail.com
Mon Feb 4 00:05:53 PST 2008
On Mon, 2008-02-04 at 07:48 +0000, Richard Hughes wrote:
> I guess we have to switch the daemon to en_US.UTF-8 to get this stuff
> back up the stack. Is this a sane idea?
What about something quick and nasty like this:
diff --git a/src/pk-main.c b/src/pk-main.c
index bd4dcb8..b526e74 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
+#include <locale.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <dbus/dbus-glib.h>
@@ -177,6 +178,9 @@ main (int argc, char *argv[])
dbus_g_thread_init ();
g_type_init ();
+ /* we need this for UTF8" */
+ setlocale (LC_ALL, "en_US.UTF-8");
+
context = g_option_context_new (_("PackageKit daemon"));
g_option_context_add_main_entries (context, options, NULL);
g_option_context_parse (context, &argc, &argv, NULL);
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index 2cbb7c0..455ec37 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -296,8 +296,10 @@ pk_spawn_command (PkSpawn *spawn, const gchar *command)
/* split command line */
argv = g_strsplit (command, " ", 0);
+ const gchar *envp[] = {"LANG=en_US.UTF-8", NULL};
+
/* create spawned object for tracking */
- ret = g_spawn_async_with_pipes (NULL, argv, NULL,
+ ret = g_spawn_async_with_pipes (NULL, argv, (gchar**) envp,
G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
NULL, NULL, &spawn->priv->child_pid,
NULL, /* stdin */
Richard.
More information about the PackageKit
mailing list