I made an XML document "by hand" and wrote it to a file.
I then tried to read it with an XmlTextReader wrapping a FileStream. I
got an XmlException about "cannot switch to Unicode" or something.
Changing the from this:
<?xml version="1.0" encoding="utf-16"?>
to this
<?xml version="1.0" encoding="utf-8"?>
lets it run - why?
Joe Fawcett - 22 Jul 2008 08:09 GMT
> I made an XML document "by hand" and wrote it to a file.
>
[quoted text clipped - 9 lines]
>
> lets it run - why?
Most likely because your actual encoding clashes with the one stated in the
version declaration..
If you want to fix it then give a minimal example of how you created your
file and how you attempt to read it.

Signature
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
Martin Honnen - 22 Jul 2008 12:25 GMT
> I made an XML document "by hand" and wrote it to a file.
>
[quoted text clipped - 9 lines]
>
> lets it run - why?
That sounds to me as if the XML document created "by hand" has a BOM
indicating UTF-8 while you inserted an XML declaration declaring the
encoding as UTF-16. So check how you saved the XML document, your editor
might allow you to choose the encoding, if you want UTF-16 then make
sure you save with that encoding.

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/