This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: BUG: %lc in printf fails with transliteration
- To: Markus Kuhn <Markus dot Kuhn at cl dot cam dot ac dot uk>
- Subject: Re: BUG: %lc in printf fails with transliteration
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 25 Sep 2000 09:41:50 -0700
- Cc: libc-alpha at sources dot redhat dot com
- References: <E13dazw-00043V-00@wisbech.cl.cam.ac.uk>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> writes:
> The standard (§7.20) only says that
>
> "MB_CUR_MAX [..]
> expands to a positive integer expression with type
> size_t that is the maximum number of bytes in a multibyte
> character for the extended character set specified by the
> current locale (category LC_CTYPE), which is never greater
> than MB_LEN_MAX.
>
> If a locale contains a transliteration L"ü" -> "ue", then for this
> locale the implementation will have to make sure that MB_CUR_MAX >=
> strlen("ue").
First of all, this is everything but practical. Many programs assume
MB_CUR_MAX to be an attribute of the charset which is used to trigger
certain handling. This all would break. Second, I deliberately
didn't enable the transliteration for the wc*tomb* functions since in
the contexts they are used they have to be exact. THere is even an
error number defined for the case an invalid character is found. This
is different from the stream handling where this is keft
implementation defined. Also, iconv() also does not enable
transliteration by default for the same reason.
It is a bad idea to do this since it is greatly reducing portability
and the ability to develop programs on Linux for other architectures.
Stdio is used for output which might also lead to some
incompatibilities but the standard says so and the most problematic
situations (e.g., compilers converting input to multibyte) is done
using wc*tomb and iconv().
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------