0
I’m having trouble serializing an xml, the same is being generated with encoding="utf-16"
.
But the xsd
is with encoding="utf-8"
, how I make it to be generated with utf-8
?
var xml = string.Empty;
var serialize = new XmlSerializer(typeof(Consulta));
using (var strignWriter = new StringWriter())
{
using (var xmlWriter = XmlWriter.Create(strignWriter, new XmlWriterSettings { Indent = true }))
{
serialize.Serialize(xmlWriter, xmlConsulta);
xml = strignWriter.ToString();
}
}
I don’t get it, he got like this:
– João Bosco
How is the class structure
consulta
and the value you are assigning toxmlConsulta
?– Leandro Angelo
See this http://www.csharp411.com/how-to-force-xmlwriter-or-xmltextwriter-to-use-encoding-other-than-utf-16/
– Leandro Angelo
opa, thanks get with the link above.
– João Bosco
I edited the answer, presenting this solution. :)
– Leandro Angelo