Fix for XML encoding from membuffer
This commit is contained in:
@@ -17,7 +17,12 @@ namespace Swarmops.Logic.Communications.Transmission
|
||||
serializer.Serialize (stream, this);
|
||||
|
||||
byte[] xmlBytes = stream.GetBuffer();
|
||||
return Encoding.UTF8.GetString (xmlBytes);
|
||||
string xml = Encoding.UTF8.GetString (xmlBytes);
|
||||
|
||||
xml = xml.Replace("�", "");
|
||||
xml = xml.Replace("\x00", "");
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
||||
public static T FromXml (string xml)
|
||||
|
||||
@@ -16,7 +16,12 @@ namespace Swarmops.Logic.Support.LogEntries
|
||||
serializer.Serialize (stream, this);
|
||||
|
||||
byte[] xmlBytes = stream.GetBuffer();
|
||||
return Encoding.UTF8.GetString (xmlBytes);
|
||||
string xml = Encoding.UTF8.GetString (xmlBytes);
|
||||
|
||||
xml = xml.Replace("�", "");
|
||||
xml = xml.Replace("\x00", "");
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
||||
public static T FromXml (string xml) // 'T' might not work here, like it didn't in ToXml()
|
||||
|
||||
Reference in New Issue
Block a user