Why is an iso-8859-1 character not converted to utf-8 in the output file when setting output encoding to utf-8?
I have an xml input file in iso-8859-1 encoding, and the encoding is declared. I want to output it in utf-8. My understanding is that setting the output encoding in the xslt file should manage the character conversion.
Is my understanding wrong? If not, why does the following simple test case output an iso-8859-1 character in a utf-8 declared output file?
My input file looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<data>ö</data>
My transform looks like this:
<?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 looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<result>ö</result>
The ö in my result file is 0xF6 according to BabelPad, which is an invalid utf-8 character. The ö seems to be untouched by the transformation.
Thanks for any help!
öisn't a valid UTF-8 character? - Mads Hansenerror on line 2 at column 9: Encoding error- Esailija