Received: from eggs.gnu.org ([2001:4830:134:3::10]:58086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9zPH-0007K3-VZ for qemu-devel@nongnu.org; Fri, 18 Dec 2015 13:05:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9zPD-00039g-Uw for qemu-devel@nongnu.org; Fri, 18 Dec 2015 13:05:31 -0500 Received: from smtp3.mundo-r.com ([212.51.32.191]:26095 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9zPD-0002ds-OM for qemu-devel@nongnu.org; Fri, 18 Dec 2015 13:05:27 -0500 From: Alberto Garcia In-Reply-To: <1450445013.15674.38.camel@redhat.com> References: <1441898372-32679-1-git-send-email-berto@igalia.com> <20151218113844.GA31910@noname.redhat.com> <1450445013.15674.38.camel@redhat.com> Date: Fri, 18 Dec 2015 19:04:20 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] gtk: use setlocale() for LC_MESSAGES only List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann , Kevin Wolf Cc: qemu-devel@nongnu.org, Markus Armbruster >> > 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. >> > >> 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. That affects functions in ctype.h (isalpha(), islower(), isupper(), ...) I guess that's safe? > @@ -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"); You can also modify the comment in early_gtk_display_init() to say that " we support importing LC_MESSAGES and LC_CTYPE from the environment ". Berto