XslCompiledTransform uses UTF-16 encoding

后端 未结 2 472
梦如初夏
梦如初夏 2021-01-11 15:26

I have the following code, which I want to output xml data using the UTF-8 encoding format. but it always outputs data in UTF-16 :

        XslCompiledTransfo         


        
2条回答
  •  一生所求
    2021-01-11 16:18

    If you use a MemoryStream in place of the StringBuilder, the XmlWriter will respect the encoding you specify in the XmlWriterSettings, since the MemoryStream doesn't have an inherent encoding like the StringBuilder does.

提交回复
热议问题