[jdom-interest] Directly referenced special characters as "?"

Pramodh Peddi peddip at contextmedia.com
Thu Nov 6 00:17:03 PST 2003


Hi,
I know this is not a question on JDOM, but I was just wondering if any one
help me with my problem.

I am having an xml (source) file which has  different special characters -
some of which are referenced thru entities (like &#8482) and others are
referenced directly (like ® and ©). The entity referenced characters are
coming up fine while transforming, but the directly referenced chars are
coming up as "?" chars.

I am using Java1.4.2's Transformer for transforming.

This is what I am doing on the Java code:
*********************************************************

if (filePath != null) {

sftp.get(filePath, rawfileOutputStream);

rawfileOutputStream.close();

}

ByteArrayInputStream rawfileInputStream = new
ByteArrayInputStream(rawfileOutputStream.toByteArray());

ByteArrayOutputStream transformedFileOutputStream = new
ByteArrayOutputStream();


File transformedFile = new File("../server/ic/deploy/data.war/" +
this.taxXSLTResult);

FileOutputStream out = new FileOutputStream(transformedFile);


transformer.transform(

new StreamSource(new InputStreamReader(rawfileInputStream), this.dtdURL),

new StreamResult(out));

rawfileInputStream.close();

transformedFileOutputStream.close();

****************************************************************************
********************

The source file has "windows-1252" encoding header. And in xsl, I tried xsl:
encoding="iso-8859-1" and xsl: encoding = "windows-1252". Niether of these
worked. I even tried to shange the bytes into String and again into bytes.
Nothing works.

I would really appreciate if anyone I can get any help!!


Thanks in advance,

Pramodh.





More information about the jdom-interest mailing list