Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm trying to build some XML through an XSLT file, when I set:
<xsl:output method="xml" omit-xml-declaration="no"/>
Then I get the following in the resulting XML:</p> <pre><span class="pi"><?xml version="1.0" encoding="utf-16"?></span>
However, my XML definition at the top of the XSLT file says:</p> <pre><span class="pi"><?xml version="1.0" encoding="utf-8"?></span>
So, why am I getting utf-16? How do I change this to utf-8?
Argh.. it's messed up again... You get the point, right? ;-)
Hi Sebastiaan,
You could try the following...
Switch the omit-xml-declaration to "yes"
<xsl:output method="xml" omit-xml-declaration="yes"/>
... and then include the UTF-8 XML declaration as CDATA?
<xsl:text disable-output-escaping="yes"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]></xsl:text>
Let me know if that works.
Cheers, Lee
The reason for the UTF-16 encoding is due to how .NET maintains characters internally within the framework.
Works great Lee, thanks!
And good to hear that there is a reason.
You're welcome. Glad it worked!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
XML encoding is utf-16 ?
I'm trying to build some XML through an XSLT file, when I set:
Then I get the following in the resulting XML:</p> <pre><span class="pi"><?xml version="1.0" encoding="utf-16"?></span>
However, my XML definition at the top of the XSLT file says:</p> <pre><span class="pi"><?xml version="1.0" encoding="utf-8"?></span>
So, why am I getting utf-16? How do I change this to utf-8?
Argh.. it's messed up again... You get the point, right? ;-)
Hi Sebastiaan,
You could try the following...
Switch the omit-xml-declaration to "yes"
... and then include the UTF-8 XML declaration as CDATA?
Let me know if that works.
Cheers, Lee
The reason for the UTF-16 encoding is due to how .NET maintains characters internally within the framework.
Works great Lee, thanks!
And good to hear that there is a reason.
You're welcome. Glad it worked!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.