Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9268027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:42:12+00:00 2026-06-18T14:42:12+00:00

Why is an iso-8859-1 character not converted to utf-8 in the output file when

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:42:14+00:00Added an answer on June 18, 2026 at 2:42 pm

    I can see two possible explanations (thought there are probably others).

    (a) the final stage of serialization, that is, converting characters to bytes, is not being done by the XSLT processor but by some other piece of software that does not have access to the stylesheet. This would happen, for example, if you run the transformation in a Java application that sends the output to a Writer rather than an OutputStream – the Writer would convert characters to bytes using the platform default encoding, which is probably iso-8859-1.

    (b) the octets you are seeing in your display are not the octets stored on disk, but some transformation of them. This can happen when you load a file into an editor and then ask for a hex display; in some cases you will get a hex display of the editor’s in-memory representation of the document, not of what is stored on disk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large CVS repository containing files in ISO-8859-1 and want to convert
i need to convert a Utf-16BE in ISO-8859-1 in PHP (i'm not an expert
I have been given a file, (probably) encoded in Latin-1 (ISO 8859-1), and there
Is iso-8859-1 a proper subset of utf-8? What about iso-8859-n? What about windows-1252? If
I'm converting a legacy app from ISO-8859-1 to UTF-8, and I've used a number
I have a script in python that needs to read iso-8859-1 files and also
So given this input string: =?ISO-8859-1?Q?TEST=2C_This_Is_A_Test_of_Some_Encoding=AE?= And this function: private string DecodeSubject(string input) {
So I got a site that uses ISO-8859-1 encoding and I can't change that.
I have a problem with character encoding in some HTML pages. It seems that
I've got java source files with iso-8859-1 encoding. When I run ant , I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.