xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Niemann <xml.transforma...@yahoo.com>
Subject Character encoding problem
Date Mon, 12 Nov 2007 11:07:27 GMT
I've read quite a few older postings about encodig problems and mine might not be connected
to FOP directly.
I pass two streams to FOP. The xslt stream includes the output tag with its encoding set to
UTF-8 but still the resulting pdf doesn't show the german Umlaute correctly.

I'm using the following code to call the transformer. The method get both the XML and XSLT
as Strings via the parameters xmlinput and xsltinput:

InputStream xmlin = new ByteArrayInputStream(xmlinput.getBytes());
InputStream xsltin = new ByteArrayInputStream(xsltinput.getBytes());
out = new ByteArrayOutputStream();
FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
try {
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
        // Setup XSLT
        TransformerFactory factory = TransformerFactory.newInstance();        
        Transformer transformer = factory.newTransformer(new StreamSource(xsltin));
        transformer.setOutputProperty("encoding", "UTF-8");
        Source src = new StreamSource(xmlin);
        Result res = new SAXResult(fop.getDefaultHandler());
        // Start XSLT transformation and FOP processing
        transformer.transform(src, res);     


Is there some setting I am missing?


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
View raw message