qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Alberto Garcia <berto@igalia.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] gtk: use setlocale() for LC_MESSAGES only
Date: Fri, 18 Dec 2015 14:23:33 +0100	[thread overview]
Message-ID: <1450445013.15674.38.camel@redhat.com> (raw)
In-Reply-To: <20151218113844.GA31910@noname.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]

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 <berto@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


[-- Attachment #2: 0001-gtk-fix-utf8-strings-in-the-ui.patch --]
[-- Type: text/x-patch, Size: 1175 bytes --]

From 54821a4b405ca31c997485b563ec5c43dd53e4ed Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@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 <kwolf@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@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	other threads:[~2015-12-18 13:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 15:19 [Qemu-devel] [PATCH] gtk: use setlocale() for LC_MESSAGES only Alberto Garcia
2015-09-11  9:12 ` Gerd Hoffmann
2015-12-18 11:38 ` Kevin Wolf
2015-12-18 13:23   ` Gerd Hoffmann [this message]
2015-12-18 15:38     ` Kevin Wolf
2015-12-18 18:04     ` Alberto Garcia
2015-12-18 19:55       ` Markus Armbruster
2015-12-21 17:49         ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450445013.15674.38.camel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berto@igalia.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).