This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: question with xalan, java, utf8
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 19 Apr 2002 23:16:06 +0100
- Subject: RE: [xsl] question with xalan, java, utf8
- Reply-to: xsl-list at lists dot mulberrytech dot com
> I'm trying to output HTML using UTF-8 characters. When I use Instant
> Saxon with my xml and xsl file, all if well. But if I try to do this
> through Java I've had multiple problems!
>
> FileWriter output = new FileWriter("/tmp/testlog");
>
When you provide a Writer as the output destination, Saxon simply writes
characters to the Writer. The Writer itself translates these into bytes,
using whatever encoding it decides is apppropriate. If you want to control
the encoding from the stylesheet, you must supply an OutputStream, not a
Writer - that way it's Saxon's job to convert characters to bytes, not
Java's.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list