remove encoding="utf-16" before deserialize

This commit is contained in:
John Jenko 2011-09-28 13:27:31 +00:00
parent c9dddd2f1f
commit f25b2828ca

View File

@ -28,9 +28,10 @@ namespace Volian.Base.Library
public static T StringDeserialize(string s)
{
T t;
string ss = s.Replace("encoding=\"utf-16\"", "");
XmlSerializer xs = new XmlSerializer(typeof(T));
UTF8Encoding enc = new UTF8Encoding();
Byte[] arrBytData = enc.GetBytes(s);
Byte[] arrBytData = enc.GetBytes(ss);
using (MemoryStream ms = new MemoryStream(arrBytData))
{
t = (T)xs.Deserialize(ms);