Hi there,
how do you set the encoding format of an XML string? When I
was outputting the XML to a file you can specify the encoding format like
so:
XmlTextWriter myWriter;
myWriter = new XmlTextWriter(myXMLFile, System.Text.Encoding.UTF8);
XmlSerializer serializer = new XmlSerializer(typeof(@event));
serializer.Serialize(myWriter, myEvent);
but I now want to output the XML as a string:
XmlSerializer serialiser = new XmlSerializer(typeof(@event));
TextWriter textWriter = new StringWriter();
XmlWriter writer = new XmlTextWriter(textWriter);
serialiser.Serialize(writer, myEvent);
strData = textWriter.ToString();
there is no way of setting the encoding format and it is set to UTF16
instead of UTF8 as required by the customer.
Any ideas?