tech-userlevel archive

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

Problem with wcwidth(3)



Hello,

there may be a problem with the wcwidth(3) function. The C code

#include <locale.h>
#include <stdio.h>
#include <wchar.h>
int main ()
{
        printf("locale: %s\n", setlocale(LC_ALL, ""));
        printf("wcwidth(0x0301) = %d\n", wcwidth (0x0301));
        printf("wcwidth(0x05B0) = %d\n", wcwidth (0x05B0));
        printf("wcwidth(0x200B) = %d\n", wcwidth (0x200B));
}

outputs on NetBSD 6.1.5:

locale: C/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/en_US.UTF-8
wcwidth(0x0301) = 1
wcwidth(0x05B0) = 1
wcwidth(0x200B) = 1

which is wrong since all glyphs have zero width.

E.g. output on OpenBSD 5.7 is:

locale: C/en_US.UTF-8/C/C/C/en_US.UTF-8
wcwidth(0x0301) = 0
wcwidth(0x05B0) = 0
wcwidth(0x200B) = 0

(This test is used in groff's configure and leads to use gnulib's internal wcwidth instead of NetBSD's one.)

Is this something which could be fixed or is already in CURRENT?

Carsten


Home | Main Index | Thread Index | Old Index