[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: encoding problem while reading the content in

Subject: Re: encoding problem while reading the content in
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Tue, 11 Nov 2003 23:13:12 +0100
transformer.transform check the output
Pramodh Peddi wrote:
I am reading an xml file from an sftp location and passing that through the
Transformer (using Java1.4.1's API). The xml file has "windows-1252"
encoding declared. It has special characters like ® directly put in the
file.
...
Any one has any suggestions? I would greatly appreciate!

Just avoid dealing with the encoding yourself and leave it to the XML parser, for example use plain

byte[] rawData = rawfileOutputStream.toByteArray();
transformer.transform(
  new StreamSource(new ByteArrayInputStream(rawData)),
  new StreamResult(new OutputStreamWriter(out));

If the parser can't handle the windows-1252 encoding and barfs,
get another one.
If you want to check the output you should use UTF-8 as encoding
(the default) and use an UTF-8 capable viewer (Emacs 21 will do
on Solaris).

J.Pietschmann


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.