This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: BUG REPORT: glibc 2.2 mbrtowc() fails to decode final byte
- To: Markus Kuhn <Markus dot Kuhn at cl dot cam dot ac dot uk>
- Subject: Re: BUG REPORT: glibc 2.2 mbrtowc() fails to decode final byte
- From: Andreas Jaeger <aj at suse dot de>
- Date: 10 Jan 2001 21:53:37 +0100
- Cc: bug-glibc at gnu dot org, libc-alpha at sourceware dot cygnus dot com
- References: <E14GS4H-0007AT-00@wisbech.cl.cam.ac.uk>
>>>>> Markus Kuhn writes:
> The following regression test fails in glibc 2.2 under linux-i386:
> -------------------------------------------------------------------
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> #include <assert.h>
> #include <wchar.h>
> #include <locale.h>
> int main() {
> // UTF-8 single byte feeding test for mbrtowc()
> wchar_t wc;
> mbstate_t s;
> char *locale = "en_GB.UTF-8";
> if (!setlocale(LC_CTYPE,locale)) {
> fprintf(stderr, "locale '%s' not available!\n", locale);
> exit(1);
> }
> wc = 42; /* arbitrary number */
> assert(mbrtowc(NULL, NULL, 0, &s) == 0); /* get s into initial state */
> assert(mbrtowc(&wc, "", 1, &s) == 0); /* test final byte processing */
> assert(wc == 0); /* test final byte decoding */
> return 0;
> }
> -------------------------------------------------------------------
It seems that this is fixed in the current pre release. Can I add
your program to the glibc test suite? I guess it would I can change
the locale to de_DE.UTF-8 (that makes integration in the test suite
easier ;-).
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj