This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: BUG: %lc in printf fails
- To: Markus Kuhn <Markus dot Kuhn at cl dot cam dot ac dot uk>
- Subject: Re: BUG: %lc in printf fails
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 24 Sep 2000 23:46:24 -0700
- Cc: libc-alpha at sources dot redhat dot com, gcc at gcc dot gnu dot org
- References: <E13csgo-0004s5-00@wisbech.cl.cam.ac.uk>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> writes:
> ---------------------------------------------------------------
> #define _XOPEN_SOURCE
>
> #include <stdio.h>
> #include <wchar.h>
>
> int main() {
> wint_t c = L'ü';
>
> printf("wcwidth(L'%lc') = %d\n", c, wcwidth(c));
>
> return 0;
> }
> ---------------------------------------------------------------
>
> produces the unexpected output
>
> ---------------------------------------------------------------
> wcwidth(L'---------------------------------------------------------------
>
> as opposed to the expected output
>
> ---------------------------------------------------------------
> wcwidth(L'ue') = 2
> ---------------------------------------------------------------
This is what you expect but this is not what the implementation is in
the moment supposed to do. There is a subtle difference to your other
test case since here you are using the byte stream function. This
means that there is not codecvt structure associated with the stream.
Instead, the wc*tomb* functions are used. But these cannot handle
transliteration.
So, this is a feature, not a bug. One might want to remove it at some
time but it's not high on the priority list.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------