[PATCH/RFA] Revamp wctomb/mbtowc conversion, add more charset support

Jeff Johnston jjohnstn@redhat.com
Fri Mar 20 18:11:00 GMT 2009


Corinna Vinschen wrote:
> On Mar 20 13:00, Corinna Vinschen wrote:
>   
>> Hi,
>>
>> this is a rather big patch which is split in two due to the 100K
>> mail size restriction on sourceware.  What it does is this:
>>
>> - Add support for correct ISO-8859-x charset handling.
>>
>> - Add support for a couple of default ANSI codepages used on Windows,
>>   CP737, CP775, CP1125, CP1250, CP1251, CP1252, CP1253, CP1254, CP1255,
>>   CP1256, CP1257, CP1258.
>>
>> These new charsets require a couple of new character conversion tables
>> which I put into a new file called libc/stdlib/sb_charsets.c, and which
>> are only built on _MB_CAPABLE systems.  The complete size of these new
>> tables is 5760 bytes on systems with sizeof(wchar_t)==2, 11520 bytes on
>> sizeof(wchar_t)==4 systems.  I think that's not too much.
>> Size-constraint systems will not build with _MB_CAPABLE anyway.
>>     
>
> In the meantime I found that I have to add support for the Windows
> codepages 720, 850, 852, 855, 857, 858, 862, 866 and 874 as well,
> to work correctly in certain scenarios on Cygwin.  In my local
> copy of the patch I just added these codepages unconditionally in
> the _MB_CAPABLE case.  This raises the size of the translation tables
> to 8320 or 16640 bytes, dependent on sizeof (wchar_t).
>
> If you want me to disable certain translation tables and charsets
> when not building for Cygwin, feel free to give me a set of unwanted
> charsets.
>
>   
If only Cygwin will use these, flag them Cygwin or segregate them to 
sys/cygwin.  Otherwise you will need to add configuration options for 
specifying them so that the default will be current behavior (and 
current size).  The option(s) would be comma seperated and could take a 
value of "all" to indicate all are enabled.  You should also make the 
option default like other configure.host options so that Cygwin can 
default to "all" and it doesn't require specification on the configure 
line.  The iconv translation tables have similar options already in 
newlib/configure.in.

-- Jeff J.



More information about the Newlib mailing list