DataTable XML output in UTF8, not UTF16

I have a DataTable that I am creating an XML file from using .WriteXML (..), although I have a problem with exporting it in UTF-16 encoding, and there seems to be no explicit way to change it. I understand that .NET uses UTF-16 inside strings, is this correct?

Then I run the XML that DataTable.WriteXML () creates through XSLT, which includes the following in the output declaration:

<xsl:output method="xml" indent="yes" encoding="utf-8" />

But still, the way out of the conversion is in UTF16, and the system I'm trying to enter in this XML file does not support UTF16.

Is there a way to force output to UTF-8?

+4
source share
1 answer

encoding <xsl:output> - XML XML, XSLT.

:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output encoding="utf-8"/>

 <xsl:template match="/">
   <t>Hello, world!</t>
 </xsl:template>
</xsl:stylesheet>

XML- ( ), :

<?xml version="1.0" encoding="utf-8"?><t>Hello, world!</t>

. .NET XmlWriter, , XslCompiledTransform.Transform(). . this, , XmlWriterSettings.

+1

All Articles