This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: Question
- From: "J. Johnston" <jjohnstn at redhat dot com>
- To: mail_lists at mail dot ru
- Cc: newlib at sources dot redhat dot com
- Date: Mon, 21 Jul 2003 14:22:13 -0400
- Subject: Re: Question
- Organization: Red Hat Inc.
- References: <3F16ADE2.4000904@mail.ru>
mail_lists@mail.ru wrote:
Hello.
Would anybody explain me please, why __jp2uc() call is needed in
newlib-1.11.0/newlib/libc/ctype/iswalpha.c, lines 80, 85, 90.
As I understand, this is a conversion from JIS, SJIS and EUCJP to
Unicode. But, wide characters are independent from any encoding type
and are usually already represented by Unicode.
Thanks.
Artem.
The answer is historical. Unicode support wasn't added until later. The JIS, SJIS, and
EUCJP wchar_t support was initially added as part of an embedded processor contract back in the
Cygnus Solutions days. To minimize the footprint, the implementation chose to convert into simple
double-byte characters based on the initial character set; the effect being that one couldn't convert
from one character set into wchar_t and then back into another.
Now that we have unicode support, we could add a __uc2jp function and then use that function and __jp2uc
when converting. This could be under the control of configuration such that smaller existing platforms
could still use the old design.
-- Jeff J.