Consultor Eletrônico



Kbase P131248: Central European characters corrupted when saving to an XML file
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/05/2008
Status: Unverified

FACT(s) (Environment):

Windows
All Supported Operating Systems
OpenEdge 10.1x

SYMPTOM(s):

Central European characters corrupted when saving to an XML file

Saving Central European characters to a mem pointer and then writing the mem pointer to an XML file, corrupts the characters.

-cpinternal and -cpstream are set to 1250

In the XML file the central European characters are displayed as multiple strange characters.

Using the SAVE method to save the XML document.

CAUSE:

The ENCODING attribute for the X-document object is not set. So the SAVE method saves the file with the default encoding of UTF-8, and any extended characters (Central European or any other region) are written as multiple byte characters. Which explains why each expected character appears to be written as several other characters.

FIX:

Before using the SAVE method to save the XML file, set its encoding with the correct IANA encoding name. For example:

hDoc:ENCODING = 'windows-1250'.
hDoc:SAVE("MEMPTR":U, memDoc).

For a list of IANA encodings and the corresponding ABL code pages see the 'ENCODING Attribute' in the ABL Reference.