Hello Hussein,

Thank you for your prompt reply. I really appreciate that.
Yes, You are correct I am using XSLT stylesheet to convert the XML source
to XSL-FO.

The code is as follows:

InputStream xsltfile = null;
ClassLoader cl = this.getClass().getClassLoader();
xsltfile = cl.getResourceAsStream(reportName + ".xsl");
out = new ByteArrayOutputStream();
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new StreamSource(
xsltfile));
byte[] xmlByteArray = xmlString.getBytes();
ByteArrayInputStream xmlStream = new ByteArrayInputStream(xmlByteArray);
Source src = new SAXSource(new InputSource(xmlStream));
Result res = new StreamResult(out);

// Start XSLT transformation and FOP processing
 transformer.transform(src, res);

byte[] content = out.toByteArray();
rptDto.setContent(this.fo2rtf(content));

------------------------------

Then my fo2rtf code is as follows:

 Converter converter = new Converter();
      converter.setProperty("outputFormat", "rtf");
      converter.setProperty("outputEncoding", "Cp1252");
      converter.setProperty("imageResolution", "120");
      InputSource src = new InputSource(new ByteArrayInputStream(fo)); //fo
is a byte array
      OutputDestination dst = new OutputDestination(output);
     converter.convert(src,dst);

My xsl file has the following encoding:


     <?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="
http://www.w3.org/1999/XSL/Format"; xmlns:rx="
http://www.renderx.com/XSL/Extensions"; version="1.0">

 <xsl:output method="xml" version="1.0" encoding="utf-8"/>
 <!-- **************************************************** -->
 <!-- Topmost template                                     -->
 <xsl:template match="reportname">
  <fo:root>
   <fo:layout-master-set>
    <!-- First page: used for the title -->
     etc....

My oracle database also has utf-8 format. I am not sure where I am making
mistakes.


Thank you again Hussein, for helping me in this issue.

Regards,
Kavitha.





On Fri, Jul 16, 2010 at 2:26 AM, Hussein Shafie <[email protected]> wrote:

> Kavitha Saravanan wrote:
> > I have some issues when we have to display some latin
> > characters in rtf document. i am getting weird characters in the rtf
> > document. For an example i am getting È character
>
> This looks like UTF-8.
>
>
>
> > when try to print
> > this È latin character. My xslt file has "ISO-8859-1" type encoding, and
> > my converter's output encoding is also "ISO-8859-1".  Could you please
> > help me to resolve this issue?
>
> Unlike the other translators, the RTF translator does not support
> "ISO-8859-1". Please specify "Cp1252" (which is nearly the same as
> "ISO-8859-1"). See
> http://www.xmlmind.com/foconverter/_distrib/doc/user/command_line_java.html
>
> Now, if the above fix does not work, it's difficult to help you because
> we *cannot* *reproduce* the problem you describe. Please send us
> everything needed to reproduce the above problem. See
> http://www.xmlmind.com/foconverter/support.html#xfc_support_policy
>
>
>
> ---
> PS: May be your XSLT stylesheet is used to convert an XML source
> document to XSL-FO (which is then translated to RTF). In such case:
>
> [1] Make sure that the XML source document encoding is correct. I mean
> an XML file may pretend to be encoded in "ISO-8859-1" (<?xml
> version="1.0" encoding="ISO-8859-1"?>), while in fact it contains "UTF-8".
>
> [2] For the same reason, make sure that the encoding of the generated
> XSL-FO file is correct too.
>
>
>
>
 
--
XMLmind FO Converter Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xfc-support

Reply via email to