Can someone please explain me what is the difference bet. Encoding.UTF8.GetBytes and UTF8Encoding.Default.GetBytes? Actually I am trying to convert a XML string into a stream object and what happens now is whenever I use this line:
MemoryStream stream = new MemoryStream(UTF8Encoding.Default.GetBytes(xml));
it gives me an error "System.Xml.XmlException: Invalid character in the given encoding"
but when I use this line it works fine:
**MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(xml));**
Even though it seems to be UTF8 encoding in both cases how one works and the other does not?