On Fri, Nov 24, 2017 at 12:35 PM, Hiltjo Posthuma
<hiltjo_AT_codemadness.org> wrote:
> On Wed, Nov 22, 2017 at 10:47:39PM +0100, Julien Steinhauser wrote:
>> Hello
>>
>> I've seen window title with non-ascii chars incorrectly displayed,
>> using Xutf8TextPropertyToTextList instead of XmbTextPropertyToTextList
>> as in the diff below fixed it.
>>
>> Regards
>>
>> Julien
>>
>> diff --git a/lsw.c b/lsw.c
>> index fc40fef..9a5bee1 100644
>> --- a/lsw.c
>> +++ b/lsw.c
>> _AT_@ -55,7 +55,7 @@ getname(Window win) {
>> if(!XGetTextProperty(dpy, win, &prop, netwmname) || prop.nitems == 0)
>> if(!XGetWMName(dpy, win, &prop) || prop.nitems == 0)
>> return "";
>> - if(!XmbTextPropertyToTextList(dpy, &prop, &list, &n) && n > 0) {
>> + if(!Xutf8TextPropertyToTextList(dpy, &prop, &list, &n) && n > 0) {
>> strncpy(buf, list[0], sizeof buf);
>> XFreeStringList(list);
>> } else
>>
>
> Hey,
>
> Which OS, libc and locale do you use?
> uname -a, locale, libc + version?
>
> On both OpenBSD and Linux glibc with UTF-8 locale it should not be needed.
I suspect that this is not standard-conform since the locale is set to
the "C" one on startup of a program according to
https://linux.die.net/man/3/setlocale
until setlocale is called.
The "C" locale does not support multibyte characters by default it seems:
"A program that hasn't called setlocale() can't expect to be able to
use the multibyte
interfaces reasonably anyway, so it doesn't matter that they default
to byte mode when the program starts up." from [0]
Cheers,
Silvan
[0]
http://www.openwall.com/lists/musl/2014/06/27/4
Received on Fri Nov 24 2017 - 16:53:16 CET