bug-gnulib
[Top][All Lists]
Advanced

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

iswprint() and wcwidth() don't work properly on some platforms with cert


From: Simon Kobyda
Subject: iswprint() and wcwidth() don't work properly on some platforms with certain unicodes
Date: Fri, 31 Aug 2018 14:53:58 +0200

Hello. It seems that functions gnulib's functions iswprint() and
wcwidth() return different results on different platforms.

Code on Fedora 28:

    wchar_t c = L'😀' ;
    if (iswprint(c))
        printf("Printable\n");
    else
        printf("Not printable\n");

Output: "Printable"

Code on CentOS 7:

    wchar_t c = L'😀' ;
    if (iswprint(c))
        printf("Printable\n");
    else
        printf("Not printable\n");

Output: "Not Printable"

Similar problems are encountered on also on Freebsd 11.

It seems that certain unicodes, such as zero-width characters and
emojis are considered nonprintable by iswprint() function, but unicodes
such as 稱 pass correctly. Also when these unicodes are throw at
wcwidth(), it returns incorrect width for these unicodes, but it might
be because of the fact that these unicodes are considered unprintable
(even when they are printable).


https://ci.centos.org/view/libvirt/job/libvirt-master-check/systems=libvirt-freebsd-11/1345/console

Usage of iswprint in our code: 
https://libvirt.org/git/?p=libvirt.git;a=blob;f=tools/vsh-table.c;h=d441a30f093357de99516db07249f214f9c25d0d;hb=HEAD#l264
Usage of wcwidth in our code: 
https://libvirt.org/git/?p=libvirt.git;a=blob;f=tools/vsh-table.c;h=d441a30f093357de99516db07249f214f9c25d0d;hb=HEAD#l274

Thanks,
Simon




reply via email to

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