1*7c568831SAndroid Build Coastguard WorkerIBM OS/400 implements iconv in an odd way: 2*7c568831SAndroid Build Coastguard Worker- Type iconv_t is a structure: therefore objects of this type cannot be 3*7c568831SAndroid Build Coastguard Worker compared to (iconv_t) -1. 4*7c568831SAndroid Build Coastguard Worker- Supported character sets names are all of the form IBMCCSIDccsid..., where 5*7c568831SAndroid Build Coastguard Worker ccsid is a decimal 5-digit integer identifying an IBM coded character set. 6*7c568831SAndroid Build Coastguard Worker In addition, character set names have to be given in EBCDIC. 7*7c568831SAndroid Build Coastguard Worker Standard character set names like "UTF-8" are NOT recognized. 8*7c568831SAndroid Build Coastguard Worker- The prototype of iconv_open() does not declare parameters as const, although 9*7c568831SAndroid Build Coastguard Worker they are not altered. 10*7c568831SAndroid Build Coastguard Worker 11*7c568831SAndroid Build Coastguard Worker Since libiconv does not support EBCDIC, use of this package here as a 12*7c568831SAndroid Build Coastguard Workerreplacement is not a solution. 13*7c568831SAndroid Build Coastguard Worker 14*7c568831SAndroid Build Coastguard Worker For these reasons, the code in this directory implements a wrapper to the 15*7c568831SAndroid Build Coastguard WorkerOS/400 iconv implementation. The wrapper performs the following transformations: 16*7c568831SAndroid Build Coastguard Worker- Type iconv_t is an pointer. Although OS/400 pointers are odd, comparing 17*7c568831SAndroid Build Coastguard Worker with (iconv_t) -1 is OK. 18*7c568831SAndroid Build Coastguard Worker- All IANA character set names are recognized in a coding- and case-insensitive 19*7c568831SAndroid Build Coastguard Worker way, providing an equivalent CCSID exists. see 20*7c568831SAndroid Build Coastguard Worker http://www.iana.org/assignments/character-sets/character-sets.xhtml 21*7c568831SAndroid Build Coastguard Worker- All CCSIDs from the association file can be expressed as IBMCCSIDxxxxx where 22*7c568831SAndroid Build Coastguard Worker xxxxx is the 5 digit CCSID; no null terminator is required. Alternate codes 23*7c568831SAndroid Build Coastguard Worker are of the form ibm-xxx (null-terminated), where xxx is the integer CCSID with 24*7c568831SAndroid Build Coastguard Worker leading zeroes stripped. 25*7c568831SAndroid Build Coastguard Worker- If a IANA BIBenum is defined for a CCSID, the name iana-xxx can be used, 26*7c568831SAndroid Build Coastguard Worker where xxx is the integer MIBenum without leading zeroes. 27*7c568831SAndroid Build Coastguard Worker- In addition, some aliases are also taken from the association file. Examples 28*7c568831SAndroid Build Coastguard Worker are: ASCII, EBCDIC, UTF8. 29*7c568831SAndroid Build Coastguard Worker- Prototype of iconv_open() has const parameters. 30*7c568831SAndroid Build Coastguard Worker- Character code names can be given in any code. 31*7c568831SAndroid Build Coastguard Worker 32*7c568831SAndroid Build Coastguard WorkerCharacter set names to CCSID conversion. 33*7c568831SAndroid Build Coastguard Worker- http://www.iana.org/assignments/character-sets/character-sets.xhtml provides 34*7c568831SAndroid Build Coastguard Worker all IANA registered character set names and aliases associated with a 35*7c568831SAndroid Build Coastguard Worker MIBenum, that is a unique character set identifier. 36*7c568831SAndroid Build Coastguard Worker- A hand-maintained file ccsid_mibenum.xml associates IBM CCSIDs to 37*7c568831SAndroid Build Coastguard Worker IANA MBenums. 38*7c568831SAndroid Build Coastguard Worker- An OS/400 C program (in subdirectory bldcsndfa) generates a deterministic 39*7c568831SAndroid Build Coastguard Worker finite automaton from the files mentioned above into a C file for all 40*7c568831SAndroid Build Coastguard Worker possible character set name and associating each of them with its 41*7c568831SAndroid Build Coastguard Worker corresponding CCSID. This program can only be run on OS/400 since it uses 42*7c568831SAndroid Build Coastguard Worker the native iconv support for EBCDIC. 43*7c568831SAndroid Build Coastguard Worker- Since these operations are tedious and the table generation needs bootstraping 44*7c568831SAndroid Build Coastguard Worker with libxml2, the generated automaton is stored within sources and need not 45*7c568831SAndroid Build Coastguard Worker be rebuilt at each compilation. However, source is provided here to allow 46*7c568831SAndroid Build Coastguard Worker new table generation with conversion tables that were not available at the 47*7c568831SAndroid Build Coastguard Worker time of original generation. 48