You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/06/28 17:48:28 UTC

DO NOT REPLY [Bug 10326] New: - Encoding Problems with XALAN

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10326>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10326

Encoding Problems with XALAN

           Summary: Encoding Problems with XALAN
           Product: XalanJ2
           Version: 2.4Dx
          Platform: Sun
        OS/Version: HP-UX
            Status: UNCONFIRMED
          Severity: Major
          Priority: Other
         Component: org.apache.xalan.transformer
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: pradnesh.alve@mphasis.com


Dear Sir/Madam,

We are developing a bilingual site for Citibank Korea.For this we are storing 
the Korean and the English Phrases in the Rule Engine which gets populated at 
server startup.Now when the user makes a certain request for Korean display we 
pick up the Korean Phrases from the rule engine and populate an XML whose 
encoding has been set to utf-8.
We have a XSL file which has the same encoding.
We are using a StreamResult object which accepts a OutputStreamWriter in its 
constructor.The encoding of the OutputStreamWriter has been again set to utf-8
But the Transformer simply ignores the encoding specified and in the output the 
encoding is lost.

Please reply.I am attaching a snippet of the code.

        String htmlString = null;
	
        //Creating the Writer.
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	OutputStreamWriter osw = new OutputStreamWriter(baos,"utf-8");

	StreamResult htmlResult = new StreamResult(osw);

	// get the transformer factory
	TransformerFactory tFactory = TransformerFactory.newInstance();

	// get the transformer object and set it with XSL.
	Transformer transformer = tFactory.newTransformer(xslSource);

	//Use transformer to convert XML to HTML.
	transformer.transform(xmlSource, htmlResult);

	htmlString = baos.toString("utf-8");

        //Returning the html output.
        return htmlString.