deserialize and utf8 encoding
- From: "Heron" <nospam@xxxxxxxxxx>
- Date: Fri, 27 Oct 2006 16:55:22 +0200
Hi,
I'm having a problem deserializing my streams since they are utf8 encoded
(they are being received over tcp/ip) so I was looking for a way to make the
serializer use utf8, is there any?
I'm getting the following error:
There is an error in XML document (0, 0).
innerexception: There is no Unicode byte order mark. Cannot switch to
Unicode."
public T Deserialize(Stream s)
{
XmlSerializer serializer = new XmlSerializer(typeof(T));
try
{
s.Position = 0;
return (T)serializer.Deserialize(s);
}
catch (Exception ex)
{
throw new InvalidOperationException("Failed to " +
"create object", ex);
}
}
.
- Follow-Ups:
- Re: deserialize and utf8 encoding
- From: Christof Nordiek
- Re: deserialize and utf8 encoding
- Prev by Date: Re: Add ComboBoxes in runtime based on user input, how?
- Next by Date: Re: Efficiency about hashtable, arraylist, string and synchronizat
- Previous by thread: Re: Efficiency about hashtable, arraylist, string and synchronization
- Next by thread: Re: deserialize and utf8 encoding
- Index(es):
Loading