CALL "C$XML" USING CXML-SET-ENCODING, handle, new-encoding


CXML-SET-ENCODING Op-code 42. Numeric data item that specifies the operation to perform. Each operation is defined in acucobol.def, which is included with your system.
handle USAGE handle
new-encoding pic x(n)

On Entry:

handle A parser handle.
new-encoding The new encoding value.

On Exit:

RETURN-CODE The return code is 0 if an error has occurred. The return code is positive if everything went correctly.

Encoding Support

While the ISO-8859-1 encoding is supported by C$XML, it always gives strings in UTF-8, regardless of the encoding of the XML file.

Starting with version 8.1.2, the data returned to the COBOL program will be in one of three (instead of one of two) encodings. If the encoding in the XML file is given as either US-ASCII, UTF-8, or ISO-8859-1, the data returned to the COBOL program will be encoded in that character set. The only other encoding supported by C$XML is UTF-16. If an XML file is parsed that uses UTF-16, the data will be returned to the COBOL program as UTF-8.

Note that modifying the encoding will most likely cause errors, unless you translate all the data of the XML file into the new encoding before writing it. In other words, changing the encoding attribute does NOT cause the entire XML file to be translated into the new encoding automatically. Caution should be used in this area