Månad: januari 2010

XML Encode problem change it on the fly

Sometimes you need to change the Encoding of a DataSet, this is one way to do it. In this case I asume that the dataset returned as a string by the method GetDataSetString has a wrong encoding I use MemoryStream to solve the problem.

DataSet ds = new DataSet("dsCustomer");

string xmlData = customer.GetDataSetString(ssn);

ds.ReadXml(

new MemoryStream(System.Text.Encoding.UTF8.GetBytes(xmlData)))

Annonser