Unable to load XML file with UTF-8 BOM marker using MSXML6

I have an XML file with a UTF-8 BOM marker ( EF BB BF

) at the beginning.

It also contains encoding

how <?xml version="1.0" encoding="UTF-8" ?>


I am trying to load this XML file using IXMLDOMDocument::LoadXML

that document cannot load. If I remove the BOM marker it works fine.

My question is incorrect to have the BOM marker in this case or is it a bug with MSXML (more precisely MSXML6)?


source to share

1 answer

The method IXMLDOMDocument::loadXML

expects BSTR

to be UTF-16 encoded. See this page for a discussion of the problem.

I suggest using instead IXMLDOMDocument::load

, which has various overloads that don't require UTF-16.



All Articles