On Fr, 2015-12-18 at 12:38 +0100, Kevin Wolf wrote:
> Am 10.09.2015 um 17:19 hat Alberto Garcia geschrieben:
> > The QEMU code is not internationalized and assumes that it runs under
> > the C locale, but if we use the GTK+ UI we'll end up importing the
> > locale settings from the environment. This can break things, such as
> > the JSON generator and iotest 120 in locales that use a decimal comma.
> > 
> > We do however have translations for a few simple strings for the GTK+
> > menu items, so in order to run QEMU using the C locale, and yet have a
> > translated UI let's use setlocale() for LC_MESSAGES only.
> > 
> > Signed-off-by: Alberto Garcia <be...@igalia.com>
> 
> Not sure why I noticed it only now and if it's related to any recent
> package upgrade on my side (using RHEL 7), but I noticed that non-ASCII
> characters in the GTK UI strings are broken for me and git bisect
> pointed to this commit.

I guess we need to set LC_CTYPE too.
Can you try whenever the attached patch fixes the issue?

thanks,
  Gerd

From 54821a4b405ca31c997485b563ec5c43dd53e4ed Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kra...@redhat.com>
Date: Fri, 18 Dec 2015 14:15:56 +0100
Subject: [PATCH] gtk: fix utf8 strings in the ui

Commit "2cb5d2a gtk: use setlocale() for LC_MESSAGES only" restricts
locate settings to LC_MESSAGES, to avoid bugs caused by locale-specific
number printing (LC_NUMERIC) and possibly others.

We need LC_CTYPE too to make messages with chars outside us-ascii work
correctly.  Add it.

Reported-by: Kevin Wolf <kw...@redhat.com>
Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 ui/gtk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 47b37e1..30407a5 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -2044,8 +2044,9 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
 
     s->free_scale = FALSE;
 
-    /* LC_MESSAGES only. See early_gtk_display_init() for details */
+    /* LC_MESSAGES+LC_CTYPE only. See early_gtk_display_init() for details */
     setlocale(LC_MESSAGES, "");
+    setlocale(LC_CTYPE, "");
     bindtextdomain("qemu", CONFIG_QEMU_LOCALEDIR);
     textdomain("qemu");
 
-- 
1.8.3.1

Reply via email to