onlygo
asked on
Processing UTF-16 encoded xml file
I am using msxml 4 to load a xml file into DOM tree. The problem is, the XML file is not well formed as it:
- does not specify the encoding
- does not have a byte-order mark at the beginning of the document
- contains UTF-16 encoded data
As a result, I got a "invalid character found" error when building the DOM tree. As I have no control on the XML generation side to correct this problem, I ened a workaround. One way I can think of is to dynamically insert the encoding into the xml file, but I am looking for a better way. Is there any option in msxml to specify a "default encoding" in case no encoding is specified? I am looking for something like that:
document->load("myfile.xml ", Encoding::UTF-16);
Any helps is appreciated.
- does not specify the encoding
- does not have a byte-order mark at the beginning of the document
- contains UTF-16 encoded data
As a result, I got a "invalid character found" error when building the DOM tree. As I have no control on the XML generation side to correct this problem, I ened a workaround. One way I can think of is to dynamically insert the encoding into the xml file, but I am looking for a better way. Is there any option in msxml to specify a "default encoding" in case no encoding is specified? I am looking for something like that:
document->load("myfile.xml
Any helps is appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.