Details
-
Bug
-
Status: Resolved
-
Resolution: Incomplete
-
2.4Dx
-
None
-
None
-
Operating System: HP-UX
Platform: Sun
-
10326
Description
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.