|
Packit Service |
a31ea6 |
IBM OS/400 implements iconv in an odd way:
|
|
Packit Service |
a31ea6 |
- Type iconv_t is a structure: therefore objects of this type cannot be
|
|
Packit Service |
a31ea6 |
compared to (iconv_t) -1.
|
|
Packit Service |
a31ea6 |
- Supported character sets names are all of the form IBMCCSIDccsid..., where
|
|
Packit Service |
a31ea6 |
ccsid is a decimal 5-digit integer identifying an IBM coded character set.
|
|
Packit Service |
a31ea6 |
In addition, character set names have to be given in EBCDIC.
|
|
Packit Service |
a31ea6 |
Standard character set names like "UTF-8" are NOT recognized.
|
|
Packit Service |
a31ea6 |
- The prototype of iconv_open() does not declare parameters as const, although
|
|
Packit Service |
a31ea6 |
they are not altered.
|
|
Packit Service |
a31ea6 |
|
|
Packit Service |
a31ea6 |
Since libiconv does not support EBCDIC, use of this package here as a
|
|
Packit Service |
a31ea6 |
replacement is not a solution.
|
|
Packit Service |
a31ea6 |
|
|
Packit Service |
a31ea6 |
For these reasons, the code in this directory implements a wrapper to the
|
|
Packit Service |
a31ea6 |
OS/400 iconv implementation. The wrapper performs the following transformations:
|
|
Packit Service |
a31ea6 |
- Type iconv_t is an pointer. Although OS/400 pointers are odd, comparing
|
|
Packit Service |
a31ea6 |
with (iconv_t) -1 is OK.
|
|
Packit Service |
a31ea6 |
- All IANA character set names are recognized in a coding- and case-insensitive
|
|
Packit Service |
a31ea6 |
way, providing an equivalent CCSID exists. see
|
|
Packit Service |
a31ea6 |
http://www.iana.org/assignments/character-sets/character-sets.xhtml
|
|
Packit Service |
a31ea6 |
- All CCSIDs from the association file can be expressed as IBMCCSIDxxxxx where
|
|
Packit Service |
a31ea6 |
xxxxx is the 5 digit CCSID; no null terminator is required. Alternate codes
|
|
Packit Service |
a31ea6 |
are of the form ibm-xxx (null-terminated), where xxx is the integer CCSID with
|
|
Packit Service |
a31ea6 |
leading zeroes stripped.
|
|
Packit Service |
a31ea6 |
- If a IANA BIBenum is defined for a CCSID, the name iana-xxx can be used,
|
|
Packit Service |
a31ea6 |
where xxx is the integer MIBenum without leading zeroes.
|
|
Packit Service |
a31ea6 |
- In addition, some aliases are also taken from the association file. Examples
|
|
Packit Service |
a31ea6 |
are: ASCII, EBCDIC, UTF8.
|
|
Packit Service |
a31ea6 |
- Prototype of iconv_open() has const parameters.
|
|
Packit Service |
a31ea6 |
- Character code names can be given in any code.
|
|
Packit Service |
a31ea6 |
|
|
Packit Service |
a31ea6 |
Character set names to CCSID conversion.
|
|
Packit Service |
a31ea6 |
- http://www.iana.org/assignments/character-sets/character-sets.xhtml provides
|
|
Packit Service |
a31ea6 |
all IANA registered character set names and aliases associated with a
|
|
Packit Service |
a31ea6 |
MIBenum, that is a unique character set identifier.
|
|
Packit Service |
a31ea6 |
- A hand-maintained file ccsid_mibenum.xml associates IBM CCSIDs to
|
|
Packit Service |
a31ea6 |
IANA MBenums.
|
|
Packit Service |
a31ea6 |
- An OS/400 C program (in subdirectory bldcsndfa) generates a deterministic
|
|
Packit Service |
a31ea6 |
finite automaton from the files mentioned above into a C file for all
|
|
Packit Service |
a31ea6 |
possible character set name and associating each of them with its
|
|
Packit Service |
a31ea6 |
corresponding CCSID. This program can only be run on OS/400 since it uses
|
|
Packit Service |
a31ea6 |
the native iconv support for EBCDIC.
|
|
Packit Service |
a31ea6 |
- Since these operations are tedious and the table generation needs bootstraping
|
|
Packit Service |
a31ea6 |
with libxml2, the generated automaton is stored within sources and need not
|
|
Packit Service |
a31ea6 |
be rebuilt at each compilation. However, source is provided here to allow
|
|
Packit Service |
a31ea6 |
new table generation with conversion tables that were not available at the
|
|
Packit Service |
a31ea6 |
time of original generation.
|