Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
andycurran Absent Member.
Absent Member.
1263 views

XML coding in acucobol

how would i add encoding information using the C$XML call in acucobol 7.2. I understand that version 8 onwards has the SET_ENCODING op.

Andy C

0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

RE: XML coding in acucobol

It is a call to C$XML ... Call C$XML with op-code 42 .. see here: CXML-SET-ENCODING (OP-CODE 42)

Sets the encoding attribute in the XML file. This op-code takes two parameters:

handle is a valid parser handle

new-encoding (pic x(n)) is the new encoding value

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.

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: XML coding in acucobol

You might to look at this thread: community.microfocus.com/.../8748.aspx

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.