Re: [xsl] Symbol handling in XSLT

Subject: Re: [xsl] Symbol handling in XSLT
From: Alex <alexscott@xxxxxxxxxxx>
Date: Fri, 26 Mar 2004 13:22:29 +0000
O.k.

So what difference does it make if it writes characters not bytes?
If the MSXML (Which I am coming to dislike) uses UTF-16 as a default then this means that it will interpret any entity ie. &NBSP; as a ?.


So By getting it to write out a meta-tag with encoding="ISO-8859-1" This I presume will not put the entity replacement ? in the code.

So how do I get MSXML to write:
<xsl:output method="html" encoding="ISO-8859-1" />
instead of:
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">
?
Alex


Michael Kay wrote:


When using MSXML (or any other processor, but the MSXML API seems to
encourage the problem), the xsl:output encoding has no effect unless the
encoding is actually performed by the XSLT processor. If you write to a
destination such as a DOM document or a String, then the XSLT processor
writes characters, not bytes, and the final translation to bytes is done by
someone else, downstream.

Michael Kay

# -----Original Message-----
# From: Alex [mailto:alexscott@xxxxxxxxxxx] # Sent: 26 March 2004 11:37
# To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# Subject: Re: [xsl] Symbol handling in XSLT
# # # If I add to the XSL:
# <xsl:output method="html" encoding="ISO-8859-1" /> It does # not make any difference to the output.
# The problem is happening further down the pipeline.
# # Possibly in the parser?
# # If I use Xalan to parse it I get:
# <META http-equiv="Content-Type" content="text/html; # charset=ISO-8859-1">
# # If I use MSXML to parse it I get
# <META http-equiv="Content-Type" content="text/html; charset=UTF-16">
# # I think that I need to change response.charset
# # I wonder if this is what has caused the erroneous ? marks.
# # # # # # # # # # # # # # # # Alex wrote:
# # > Hi,
# > # > It is set to Western ISO.
# > # > Should the encoding be set in the XML or the XSL?
# > # > ---
# > Alex
# > # > # > Robert Koberg wrote:
# > # >> I forgot to mention that in Win IE you can right click on the page # >> and rollover the 'Encoding' menu item to see if the # encoding matches # >> what you are trying to send.
# >>
# >> On OSX Safari you can get the encoding from the bottom of # the 'View' # >> menu.
# >>
# >> Also forgot to say that the xsl:output has the encoding # set to UTF-8.
# >>
# >> best,
# >> -Rob
# >>
# >>
# >> Robert Koberg wrote:
# >>
# >>> Michael Kay wrote:
# >>>
# >>>> # # There is an actual '?' in the html source,
# >>>>
# >>>> How do you know? Did you look at it with a hex editor? # Or with some # >>>> other piece of software that may or may not be displaying it # >>>> correctly?
# >>>
# >>>
# >>>
# >>>
# >>> If you are using some webserver to send the rendering to # the client, # >>> you might want to check what it is sending. We are currently # >>> experiencing a problem on a new server (Redhat 3.0 ES) that uses # >>> Apache 2.0 with the directive DefaultCharset set to # UTF-8; this is # >>> on top of Caucho's Resin servlet container. I have set # resin and the # >>> serlvets to return UTF-8. When going straight to resin (i.e.
# >>> http://domain:8080/webapp) the characters display # correctly, sending # >>> UTF-8. When going first through Apache (i.e. # http://domain/webapp) # >>> the resulting charset in the browser is something other # than UTF-8 # >>> (in IE it is similar to ISO-8859-1 'western-1252' if I remember # >>> correctly).
# >>>
# >>> don't know how to fix this...
# >>>
# >>> best,
# >>> -Rob
# >>>
# >>>
# >>>>
# >>>> Michael Kay
# >>>>
# >>>
# >>>
# >>> # >>>
# >>
# >>
# >> # >>
# >>
# > # > # > # > # > # > # # # #

Current Thread