title: XSLT transform with MSXML doesn't use proper encoding
body: <p>I'm using <a href="http://msdn.microsoft.com/en-us/library/ms761399%28v=VS.85%29.aspx" rel="nofollow"><code>IXMLDOMDocument::transformNode</code></a> from MSXML 3.0 to apply XSLT transforms.  Each of the transforms has an <code>xsl:output</code> directive that specifies <code>UTF-8</code> as the encoding.  For example,</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0"
                  ...
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:str="http://exslt.org/strings"
                  xmlns:math="http://exslt.org/math"
                  extension-element-prefixes="str math"&gt;
    &lt;xsl:output encoding="UTF-8" indent="yes" method="xml" /&gt;
    ...
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Yet the transformed result is always <code>UTF-16</code> (and the encoding attribute says <code>UTF-16</code>).</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-16"?&gt;
  </code></pre>
  
  <p>Is this a bug in MSXML?</p>
  
  <p>For various reasons, I'd really like to have <code>UTF-8</code>.  Is there a workaround?  Or do I have to convert the transformed result to <code>UTF-8</code> myself and patch up the encoding attribute?</p>
  
  <p><strong>Update:</strong>  I've worked around the problem by accepting the <code>UTF-16</code> encoding and prepending a byte-order mark, which satisfies the downstream users of the transformed result, but I'm still be interested in how to get <code>UTF-8</code> output.</p>