Displaying the degree symbol using XSLT

Discussion in 'XML' started by Dingbat, Apr 29, 2005.

  1. Dingbat

    Dingbat Guest

    I am finding that when I use XSLT to display convert XML like this:

    <temp units="°C">23</temp>

    the resulting HTML displays an extra character in front of the degree
    symbol, like this:

    23°C

    This happens whether I use PHP or ASP so it seems to be
    parser-independent. The XSL fragment would be something like:

    <xsl:value-of select="@units"/>

    Can anyone explain what's going on? I'm trying to develop XML files
    containing weather info, and example XSLT to format and display them,
    and this is a bit of a speedbump.

    The XML displays as expected in IE 6, ie like this:

    <temp units="°C">23</temp>

    Thanks for any help.

    Dingbat
     
    Dingbat, Apr 29, 2005
    #1
    1. Advertising

  2. That's the UTF8 encoding. So you either need to make sure that you are
    serving the file with the http headers declaring utf8 (and make sure
    that your browser understands that encoding) or perhaps you want to
    output in latin1 or ascii in which case adding
    <xsl:eek:utput encoding="iso-8859-1"/> or
    <xsl:eek:utput encoding="US-ASCII"/>
    probably works (it depends how you are calling xslt, if the final
    serialisation is being done by some other application than the xslt
    engine, encoding hints on xsl:eek:utput are likely to be ignored)

    David
     
    David Carlisle, Apr 29, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. T Kennedy
    Replies:
    4
    Views:
    12,480
    Jan Roland Eriksson
    Apr 26, 2005
  2. baumann@pan
    Replies:
    1
    Views:
    769
    Richard Bos
    Apr 15, 2005
  3. Matt Chwastek
    Replies:
    6
    Views:
    545
    Michael Angelo Ravera
    Nov 20, 2006
  4. Song Ma
    Replies:
    2
    Views:
    260
    Charles Oliver Nutter
    Jul 20, 2008
  5. Replies:
    1
    Views:
    164
    Anno Siegel
    Oct 31, 2005
Loading...

Share This Page