Non-Ascii Data Such as Accented "e" é Results as © using XMLDom

(Doc ID 1335487.1)

Last updated on JULY 17, 2017

Applies to:

Oracle XML Developers Kit - Version: and later   [Release: 10.2 and later ]
Information in this document applies to any platform.


When working with XMLDom, non-Ascii characters such as an accented French e (é)
become garbled when written to a file and the resulting display (for the é) shows as ©.

Take the following test scenario.  It may reproduce in your environment, depending on the client NLS settings (implied by the O/S or specified via NLS_LANG) and the database characterset. The code is condensed without error handling for simplicity.  To execute you need to:
a.  set the init.ora parameter utl_file_dir to allow for access to the file system (ie * to open access completely)
b.  set the path of your choice for v_file which has write access granted by step "a".

v_file VARCHAR2(500);
doc xmldom.DOMDocument;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
root_elmt xmldom.DOMElement;
header_pi xmldom.DOMProcessingInstruction;
header_node xmldom.DOMNode;

v_file := '/testcases/TAR3-3690931091/testfile.xml' ;
doc := xmldom.newDOMDocument;

header_pi := xmldom.CREATEPROCESSINGINSTRUCTION(doc, 'xml', 'version="1.0" encoding="ISO-8859-1" ');
main_node := xmldom.makeNode(doc );
header_node := xmldom.appendChild(main_node, xmldom.makeNode(header_pi));
root_elmt := xmldom.createElement( doc, 'DEMO' );

xmldom.setAttribute(root_elmt, 'xmlns:xsi', '');
xmldom.setAttribute(root_elmt, 'xsi:noNamespaceSchemaLocation', 'INFOé.xsd');
root_node := xmldom.appendChild( main_node , xmldom.makeNode(root_elmt) );

xmldom.writeToFile( doc, v_file );


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms