Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How to modify XML Encoding format to UTF-8

$
0
0

I am in Visual Studio 2012 using vb.net to serialize a message to XML. Everything looks fine except that the encoding is showing Windows-1252 in the XML file and I want it to be UTF-8. I have the encoding set to create it in UTF-8 format (see code below). So I am not sure what I am missing.

Dim xml_serializer As New System.Xml.Serialization.XmlSerializer(GetType(uapRequestType))

Dim ms As New System.IO.MemoryStream
Dim setting As New System.Xml.XmlWriterSettings
setting.Indent = True
setting.Encoding = System.Text.UTF8Encoding.Default
Dim writer As Xml.XmlWriter = Xml.XmlWriter.Create(ms, setting)
xml_serializer.Serialize(writer, request)
message = System.Text.Encoding.UTF8.GetString(ms.ToArray())


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>