Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Loading XML with encoding iso-8859-1

238 views
Skip to first unread message

Neb

unread,
Jan 6, 2006, 4:43:19 PM1/6/06
to
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

Sergey Bogdanov

unread,
Jan 7, 2006, 5:15:43 AM1/7/06
to
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);

...
}

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

0 new messages