Loading xml with encoding UTF 16 using XDocument
- by Sangram
Hi,
I am trying to read the xml document using XDocument method .
but i am getting an error when xml has
<?xml version="1.0" encoding="utf-16"?>
When i removed encoding manually.It works perfectly.
I am getting error " There is no Unicode byte order mark. Cannot switch to Unicode. "
i tried searching and i landed up here--
Why does C# XmlDocument.LoadXml(string) fail when an XML header is included?
But could not solve my problem.
My code :
XDocument xdoc = XDocument.Load(path);
Any suggestions ??
thank you.