Loading XML with encoding iso-8859-1

N

Neb

Hi,

I know that with CF 2.0, the XmlDocument doesn't support loading XML
document using encoding="ISO-8859-1". If you try, you get an
exception. Since I really need to be able to load these XML files, is
there a way I can convert the data to UTF-8 so that XmlDocument.Load()
will work ?

thanks,

neb
 
S

Sergey Bogdanov

You may try this instead:

// load xml file in windows-1252 encoding (which is almost similar with
iso-8859-1)
using (StreamReader sr = new StreamReader("path to xmlfile.xml",
Encoding.GetEncoding(1252)))
{
XmlTextReader xtr = new XmlTextReader(sr);
XmlDocument doc = new XmlDocument();
doc.Load(xtr);

...
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top