Package: locales Version: 2.3.2.ds1-20 Severity: normal According to the spec, mbrtowc(&wc, buf, 1, &st) should either return 1 and set wc, or return 0, (size_t)-1 or (size_t)-2. In this locale it returns either 0 or 1, but doesn't always set wc in the latter case, as the following test program shows. I believe it should be returning (size_t)-2 (incomplete encoding) for (most) letters, and setting wc in all the other cases (except \0).
(In iconvdata/tcvn5712-1.c, this decoding is treated as stateful, but I don't think it should be.) This behaviour sends readline into an infinite loop in this locale. ------------------------------ cut here ------------------------------ #include <stdio.h> #include <wchar.h> #include <locale.h> #include <sys/types.h> main() { int c; mbstate_t st; char buf[1]; size_t size; wchar_t wc; setlocale(LC_CTYPE, "vi_VN.tcvn"); for (c = 0; c <= 0xff; c++) { wc = 0xbaad; buf[0] = c; memset(&st, 0, sizeof(st)); size = mbrtowc(&wc, buf, 1, &st); printf("c = 0x%02x, size = %u, wc = U+%04X\n", c, size, wc); } return 0; } -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]