Re: [xsl] using xsl:message with UTF-8 characters

Subject: Re: [xsl] using xsl:message with UTF-8 characters
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Sat, 21 Apr 2007 10:00:06 +0100
Yes, as far as I know the standard Windows shell, cmd.exe, doesn't support UTF-8. I'm not sure if the newer PowerShell does.

Joe
----- Original Message ----- From: "Michael Kay" <mike@xxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, April 21, 2007 12:23 AM
Subject: RE: [xsl] using xsl:message with UTF-8 characters



Take this stylesheet:


<xsl:template name="main">
 <xsl:value-of select="'V: &#xaa;&#xba;&#x20ac;'"/>
 <xsl:message>M: &#xaa;&#xba;&#x20ac;</xsl:message>
</xsl:template>

If I run it from the command prompt in UltraEdit under WinXP, the message
(M:) displays correctly and the principal output (V:) does not.

If I run it from the command console (obtained using "cmd") both outputs are
garbage.

So it all depends on the environment; I'm afraid there's not much I can do
about that.

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: Manfred Staudinger [mailto:manfred.staudinger@xxxxxxxxx]
Sent: 20 April 2007 23:22
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] using xsl:message with UTF-8 characters

On 20/04/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> By default the output from xsl:message in Saxon goes to System.err,
> and the handling of special characters therefore depends
partly on the
> Java IO library and partly on the operating system (perhaps even on
> which command shell you are using within the operating
system). I've
> generally found that a number of shells are unable to display even
> iso-8859-1 correctly, which is why I reverted to use of ASCII
> characters only in Saxon error messages. A bit
disappointing in this day and age.
I'm using win2000 and Java version 1.5.0_10. In my example I
did not specify an output file so both, the output from
xsl:message and the output doc are displayed in the command
shell. Isn't this proof that at least the command shell can
handle the characters as expected ?

> It's easy enough to tell Saxon to send the message somewhere else
> where it won't be mangled, but the question is, where do
you actually want it?
I would like the error msg stream to be sent to the shell in
the same way as the output document was sent there. In
testing, my output doc is normally set to go to a disc file
so it would not be mixed up with the error messages.

I've seen the -m classname parameter in your documentation,
but after reading the description I still have no idea what
to specify - most likely my ignorance in java.

Manfred

> > -----Original Message-----
> > From: Manfred Staudinger [mailto:manfred.staudinger@xxxxxxxxx]
> > Sent: 20 April 2007 21:12
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] using xsl:message with UTF-8 characters
> >
> > Using XSLT 2.0 with Saxon 8.9.0.3J I would like to use
xsl:message
> > much more, but I don't know how to get
> > UTF-8 chars displayed correctly. Here is what I get when I invoke
> > test.xsl with saxon from the command line:
> >
> > >java net.sf.saxon.Transform dummy.xml test.xsl
> > a or ?that's the question  <---- I replaced a square by a true ?
> > <doc>a or d, that's the question</doc>>Exit code: 0
> >
> > The square stands for x'E4 AC A0' (which would triggers
> > base64 encoding in gmail by the way) and the text has not
only lost
> > the "d"
> > (x'C3 A4') but also the next 2 bytes ", " (x'C2 20').
> >
> > Any idea how to get xsl:message working ?
> >
> > Manfred
> >
> > test.xsl
> > <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet
> > version="2.0"
> >   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> > <xsl:output omit-xml-declaration="yes"/> <xsl:template match="/">
> > <doc>
> >   <xsl:message select="'a or d, that''s the question'"/>
> >   <xsl:value-of select="'a or d, that''s the question'"/> </doc>
> > </xsl:template> </xsl:stylesheet>

Current Thread