• No replies
100 Posts

Pinned topic Receiving error: "SQLSTATE: HY000 ERRORCODE: 9402 Error: XML parsing: line 1, character 38, unable to switch the encoding"

‏2010-07-09T18:12:04Z |
In this knowledge base entry it says to modify the UTF-8 tag to say UTF-16 to get around this issue.
 SOLUTION:  To resolve this issue you must replace the 'encoding=UTF-8' tag in the XML document with 'encoding=UTF-16'.  After changing the encoding tag in the XML document MSSQL should process the XML data.
I don't really like the idea of saying it's UTF-16 when it's not. Is there a way to write the document in UTF-16? I tried entering "UTF-16" in the "Encode data using encoding type: " field, but it comes out garbled in the graphical representation in Cast Iron Studio. It's also garbled in the destination SQL Server XML column. How can I write true UTF-16, including the UTF-16 declaration, with the Write XML activity?