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 with transliteration


Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> writes:

> It is disappointing to hear that the wc*tomb* cannot handle
> transliteration.

It is impossible with the wc*tomb* interface.  wcrtomb and wcsrtombs
don't get the size of the input buffer passed and therefore the user's
allocation of a MB_CUR_MAX bytes sized buffer must be enough.  But,
for instance for ASCII, MB_CUR_MAX is 1 and therefore we cannot
transliterate ö to oe.

> In addition, the C standard very clearly requires that
> (apart from the fwide() state issues)
> 
>   wint_t c = L'ü';
>   printf("'%lc'\n", c);
> 
> and
> 
>   wint_t c = L'ü';
>   wprintf("'%lc'\n", c);

For well defined input.  It is completely undefined what happens if
you pass invalid input.  And ö in invalid in the C locale.

-- 
---------------.                          ,-.   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]