qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] gtk: Hardcode LC_CTYPE as C.utf-8


From: Mike FABIAN
Subject: Re: [Qemu-devel] [PATCH] gtk: Hardcode LC_CTYPE as C.utf-8
Date: Tue, 31 Jan 2017 14:11:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Alberto Garcia <address@hidden> さんはかきました:

> On Tue 31 Jan 2017 11:09:45 AM CET, Kevin Wolf <address@hidden> wrote:
>
>> Recently, however, glibc introduced a new locale "C.utf-8" that just
>> uses UTF-8 as its charset, but otherwise leaves the semantics alone.
>> Just setting the right character set is enough for our use case, so we
>> can just hardcode this one without having to be afraid of nasty side
>> effects.
>
>>     setlocale(LC_MESSAGES, "");
>> +   setlocale(LC_CTYPE, "C.utf-8");
>>     bindtextdomain("qemu", CONFIG_QEMU_LOCALEDIR);
>
> A couple of quick questions:
>
> - Is it C.utf-8 or C.UTF-8 ? 'locale -a' shows only the latter in my
>   system.

Both work:

address@hidden:~
$ LC_ALL=C.utf-8 strace -eopen ls 2>&1 |  grep LC_CTYPE
open("/usr/lib/locale/C.utf-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
open("/usr/lib/locale/C.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = 3
address@hidden:~
$ LC_ALL=C.UTF-8 strace -eopen ls 2>&1 |  grep LC_CTYPE
open("/usr/lib/locale/C.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
open("/usr/lib/locale/C.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = 3
address@hidden:~
$ LC_ALL=C.UTF8 strace -eopen ls 2>&1 |  grep LC_CTYPE
open("/usr/lib/locale/C.UTF8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
open("/usr/lib/locale/C.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = 3
address@hidden:~
$ LC_ALL=C.utf8 strace -eopen ls 2>&1 |  grep LC_CTYPE
open("/usr/lib/locale/C.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = 3
address@hidden:~
$ 

I like C.UTF-8 because “UTF-8” is the official spelling
of that encoding:

https://en.wikipedia.org/wiki/UTF-8#Official_name_and_variants

Using “C.utf8” uses one stat less though because it is the last
fallback, as you can see in the strace.

> - When was this added? This bug seems to be still open:
>   https://sourceware.org/bugzilla/show_bug.cgi?id=17318

Fedora has it since Fedora 24 (spring 2016), Debian for a while longer.

I’ll ping again to get it included upstream.

It needs 1.5MB at runtime only because of

https://sourceware.org/bugzilla/show_bug.cgi?id=18978

as soon as that sorting bug is fixed, the C.UTF-8 locale will need
less than 200k.

> Berto

-- 
Mike FABIAN <address@hidden>
睡眠不足はいい仕事の敵だ。



reply via email to

[Prev in Thread] Current Thread [Next in Thread]