You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "HIRODE,KARTHEEK (HP-Boise,ex1)" <ka...@hp.com> on 2002/12/13 19:31:25 UTC

Double byte encoding problem

Hello all,
Am trying to handle double byte chars in the XML processing. The source XML
is encoded in the right encoding for the content(Shift_JIS in this instance)
and  have set up the 'transformer' with the right OutputProperty("encoding",
"Shift_JIS") where "encoding" is the attribute of <xsl:output>. The
resulting XML however is UTF-8ed out and the Japanese characters show up as
????.

So the questions I have are:
1. Does Xalan automatically detect the encoding of the sourceDocument and
process accordingly? 
2. Is there any setting other than setOutputProperty("encoding",
"Shift_JIS") for the transformations to work correctly?
3. Is there some setting on the Source and Result classes in the transform()
call to achieve this?

By the way, when we use the OutputStreamWriter or any OutputStream, the
transformations seem to work fine. 

Thanks for any leads,
--Kartheek Hirode






Versions:
 Xalan :Jan2002, Xerces: 1.4.4
Relevant code snippet:
 TransformerFactory tf  = TransformerFactory.newInstance();
 SAXTransformerFactory tFactory = (SAXTransformerFactory)tf;
 transformer = tFactory.newTransformer( new DOMSource( styleDoc ) );
 transformer.setOutputProperty("encoding", "Shift_JIS");
 transformer.transform(new DOMSource(sourceXMLDocument), new
StreamResult(stringWriter));