The preferred way to specify the code page for parsing an XML document is to omit the encoding declaration from the document and to rely on external code-page information.
Omitting the XML declaration makes it possible to transmit an XML document between heterogeneous systems without requiring that you update the encoding declaration to reflect any translation imposed by the transmission process.
Unicode XML documents do not require additional code-page information because Unicode effectively consists of a single large code page. The code page used for parsing an ASCII or EBCDIC XML document that does not have an encoding declaration is the runtime ASCII or EBCDIC code page.
You can also specify the encoding information for an XML document in the XML declaration with which most XML documents begin. (Note that the XML parser generates an exception if it encounters an XML declaration that does not begin in the first byte of an XML document.) This is an example of an XML declaration that includes an encoding declaration:
<?xml version=“1.0” encoding=“ibm-1140” ?>
Specify the encoding declaration in either of the following ways:
| Code page | Supported aliases |
|---|---|
| 037 | EBCDIC-CP-US, EBCDIC-CP-CA, EBCDIC-CP-WT, EBCDIC-CP-NL |
| 500 | EBCDIC-CP-BE, EBCDIC-CP-CH |
| 1202 | UTF-16 |
related tasks
Understanding the encoding of XML documents
related references
Locales and code pages that are supported