Somehow, sometimes the code below generates an error when loading valid Windows-1252 XML.
It fails on Windows XP Professional x86 SP3 using MSXML6.
It succeeds o
The behaviour depends on which version of the MSXML6.DLL
you have installed.
To reproduce this better, I created another file abnormal.xml
, in addition to the normal.xml
from the question.
File dump abnormal.xml
:
000000: 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31
..
File abnormal.xml
:
File dump normal.xml
:
000000: 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 20 3D 20 <
000030: 52 4F 57 20 43 69 74 79 3D 22 E0 22 2F 3E 0D 0A ROW City="."/>..
File normal.xml
:
The behaviour I expect is that:
abnormal.xml
fails, because it does not specify an encoding, but contains a character with the high-bit setnormal.xml
succeeds, as it conains a single-byte encoding supporting high-bit characters, so characters with high-bit set are allowedThese are the observed scenarios:
MSXML6 FAILURE:
reason: System error: -2146697210.
errorCode: -2146697210
url: file:///C:/My%20Dropbox/XMLEOSErrorTest/Abnormal.xml
reason: System error: -2146697210.
errorCode: -2146697210
url: file:///C:/My%20Dropbox/XMLEOSErrorTest/Normal.xml
MSXML6 SUCCESS:
reason: An invalid character was found in text content.
errorCode: -1072896760
url: file:///C:/My%20Dropbox/XMLEOSErrorTest/Abnormal.xml
srcText: