From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, Alberto Garcia <berto@igalia.com>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] QEMU produces invalid JSON due to locale-dependent code
Date: Mon, 24 Aug 2015 11:18:20 -0600 [thread overview]
Message-ID: <55DB51DC.6070704@redhat.com> (raw)
In-Reply-To: <87oahwr4x1.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 1614 bytes --]
On 08/24/2015 11:07 AM, Markus Armbruster wrote:
>> You can prevent GTK+ from calling setlocale() by using
>> gtk_disable_setlocale() before gtk_init(), but note that setlocale() is
>> needed for gettext.
>
> We can
>
> (A) Internationalize our complete code base
>
> (B) Run in the C locale
>
> Breaks GTK's internationalization.
>
> (C) Run in a mixed locale
>
> Whenever something breaks, we switch another LC_ to the C locale.
>
> Can partially break GTK's internationalization.
>
> I happily concede that (A) would be best. Until the manpower to pull it
> off appears, I recommend (B), because it's safer than (C), and avoids
> inconsistent localization, such as German messages combined with
> non-German number formatting.
Is it still possible for:
(D) Run in a controlled mixed locale
GTK runs completely in the locale determined by setlocale() (since it
never has to display raw JSON)
We fix our JSON output code to use thread-specific locale
manipulations to (temporarily) switch to C locale before printing JSON
that way, GTK still shows full German formatting for any localized
message in the GUI that happens to print numbers, but the JSON output
(which is independent of the GUI) also behaves correctly as a C-only entity.
I don't know how well mingw supports thread-specific locales (POSIX
requires it, but we all know that mingw is behind the curve when it
comes to POSIX...); BSD and glibc should be okay, though.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2015-08-24 17:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-18 23:57 [Qemu-devel] QEMU produces invalid JSON due to locale-dependent code Alberto Garcia
2015-08-24 8:58 ` Daniel P. Berrange
2015-08-24 10:05 ` Markus Armbruster
2015-08-24 10:29 ` Alberto Garcia
2015-08-24 17:07 ` Markus Armbruster
2015-08-24 17:18 ` Eric Blake [this message]
2015-08-25 7:54 ` Markus Armbruster
2015-08-25 8:15 ` Alberto Garcia
2015-08-25 12:51 ` Markus Armbruster
2015-08-26 9:13 ` Alberto Garcia
2015-08-26 9:22 ` Daniel P. Berrange
2015-08-26 9:47 ` Markus Armbruster
2015-08-24 17:56 ` Daniel P. Berrange
2015-08-24 20:27 ` Eric Blake
2015-08-26 6:46 ` Gerd Hoffmann
2015-08-26 9:57 ` Daniel P. Berrange
2015-08-26 12:04 ` Markus Armbruster
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=55DB51DC.6070704@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=kraxel@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).