While transforming XML to HTML on the server, the XSLT processor changed the
encoding from "UTF-8" to "UTF-16".
I used ASP.NET 2.0 to do the transformation on the server:
<% 'Load XML set xml = Server.CreateObject("Microsoft.XMLDOM") xml.async = false xml.load(Server.MapPath("Sample.xml")) 'Load XSL set xsl = Server.CreateObject("Microsoft.XMLDOM") xsl.async = false xsl.load(Server.MapPath("Sample.xsl")) 'Transform file Response.Write(xml.transformNode(xsl)) %> |
Figure 1, click SampleUTF16.asp to see the result.
When you have a look at Sample.xsl,
you will see that I used <xsl:output encoding="UTF-8".
The resulting html file, however had charset=UTF-16 in the META
tag.
The problem was solved by changing:
Response.Write(xml.transformNode(xsl))
into:
Response.Write(xml.transformNodeToObject(xsl,Response))
Click SampleUTF8.asp for the
result.
The problem was caused by the fact that transformNode returns a UNICODE string.