cross-encoding XSL transformations

前端 未结 1 1211
面向向阳花
面向向阳花 2021-01-28 13:23

I have some operations to do on an XML files (nothing important) and XSL applies very well in this case. However, my input file is encoded in UTF-8 and the file after the transf

相关标签:
1条回答
  • 2021-01-28 13:37

    Do you have

    <xsl:output encoding="iso-8859-1" />
    

    in place?

    Because that should be all you need, really. If your XSL processor does not correctly translate characters to the target encoding on its own, it is broken and you need to use a different one.

    Hints

    • Often Windows-1252 is what people really mean when they say ISO-8859-1. Check closely if that applies to you as well. There are subtle differences between the two (especially with regard to the Euro sign, which does not exist in ISO-8859-1, but does exist in Windows-1252 and ISO-8859-15).
    • Whenever an XML declaration <?xml version="1.0" encoding="iso-8859-1"?> is missing in an XML file, UTF-8 encoding is assumed. Be sure to put a declaration on top of your file whenever is not UTF-8 encoded.
    0 讨论(0)
提交回复
热议问题