utf-16 XML data returns "parse error"
549331Jan 10 2007 — edited Jan 13 2007I have a utf-8 Oracle db with version 10.1. I tried to insert a utf-16 XML file into XMLTYPE column using the following script,
SQL> CREATE OR REPLACE DIRECTORY xmldir AS '/home/oracle/script';
SQL> INSERT INTO xml_test values(xmltype(bfilename('XMLDIR', 'my_utf16_1.xml'), 0));
INSERT INTO xml_test values(xmltype(bfilename('XMLDIR', 'my_utf16_1.xml'), 0))
*
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-06512: at "SYS.XMLTYPE", line 259
ORA-06512: at "SYS.XMLTYPE", line 284
ORA-06512: at line 1
The file has very simple data,
<?xml version="1.0" encoding="UTF-16" ?><a/>
The file was created using "notepad" on Windows platform, and saved using "unicode" as encoding, which means "utf-16".
When the same data was saved as "utf-8", the above insertion succeeds. But for utf-16, insertion failed.
So, does Oracle XMLTYPE column accepts utf-16 encoding?