There is no Unicode byte order mark. Cannot switch to Unicode
Solution 1:
The reality of your file's encoding appears to conflict with that specified by your XML declaration. If your file actually uses one-byte characters, declaring encoding="utf-16"
won't change it to use two-byte characters, for example.
Try removing the conflicting encoding from the XML declaration. Replace
<?xml version="1.0" encoding="utf-16"?>
with
<?xml version="1.0"?>
You may also be able to load the file into a string as a work-around using LoadXML().
Solution 2:
If you are not able to change the xml file encoding as
<?xml version="1.0"?>
Alternatively, you can read the xml content directly as raw xml instead of loading it with xml path.
XmlReader.Create(new StringReader(File.ReadAllText(fileName)));
If you use XmlDocument
;
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(File.ReadAllText(filePath));