Why iso-8859-1 character is not converted to utf-8 into output file when setting output encoding to utf-8?
I have an iso-8859-1 encoded xml input file and the encoding is declared. I want to bring it to utf-8. I understand that setting the output encoding in the xslt file should control character conversion.
I understand what is wrong? If not, why does the following simple test case output the iso-8859-1 character in the declared utf-8 output file?
My input file is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?> <data>ö</data>
My conversion is as follows:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output encoding="UTF-8" /> <xsl:template match="/"> <result> <xsl:value-of select="." /> </result> </xsl:template> </xsl:stylesheet>
Using saxon9he from the command line, my result is as follows:
<?xml version="1.0" encoding="UTF-8"?> <result>ö</result>
ö in my result file is 0xF6 according to BabelPad, which is an invalid utf-8 character. The ö transformation seems untouched.
Thanks for any help!
source share