This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: BUG: %lc in printf fails


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   `------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]