-1

We are using Apache FOP 0.95 rendering system and the rendering engine crashes when it encounters a UTF-8 emoticon. I am using Java to render the data to PS/PDF format.

Is there a way to render them correctly or filter these non-renderable characters?

Here is the exception: at org.apache.xalan.templates.FuncDocument.warn(FuncDocument.java:419) at org.apache.xalan.templates.FuncDocument.getDoc(FuncDocument.java:356) at org.apache.xalan.templates.FuncDocument.execute(FuncDocument.java:192) at org.apache.xpath.Expression.bool(Expression.java:184) at org.apache.xpath.XPath.bool(XPath.java:410) at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:124) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.transformer.TransformerImpl.transformToRTF(TransformerImpl.java:1999) at org.apache.xalan.transformer.TransformerImpl.transformToGlobalRTF(TransformerImpl.java:1944) at org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:308) at org.apache.xalan.templates.XUnresolvedVariable.execute(XUnresolvedVariable.java:124) at org.apache.xpath.VariableStack.getGlobalVariable(VariableStack.java:446) at org.apache.xpath.operations.Variable.execute(Variable.java:212) at org.apache.xpath.operations.Variable.execute(Variable.java:186) at org.apache.xalan.templates.FuncDocument.execute(FuncDocument.java:77) at org.apache.xpath.XPath.execute(XPath.java:335) at org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:278) at org.apache.xalan.templates.XUnresolvedVariable.execute(XUnresolvedVariable.java:124) at org.apache.xpath.VariableStack.getGlobalVariable(VariableStack.java:446) at org.apache.xpath.operations.Variable.execute(Variable.java:212) at org.apache.xpath.operations.Variable.execute(Variable.java:186) at org.apache.xpath.axes.WalkingIterator.setRoot(WalkingIterator.java:154) at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:213) at org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:210) at org.apache.xpath.XPath.execute(XPath.java:335) at org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:278) at org.apache.xalan.templates.ElemVariable.execute(ElemVariable.java:246) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:392) at org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:246) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:392) at org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:246) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:392) at org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:246) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:392) at org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:246) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemIf.execute(ElemIf.java:160) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:393) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:176) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:393) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:176) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2281) at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1367) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:709) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262)

f_puras
  • 2,521
  • 4
  • 33
  • 38
KKS
  • 1
  • 1

1 Answers1

1

You don't say what the unwanted characters are in ...

The String.replaceAll() method is a good way to get rid of unwanted characters ... in a String.

But the other problem is knowing what these unrenderable characters are. And besides, these characters are defined by the Unicode standard ... they are not system specific in meaning.


I think you would be better off figuring out why FOP is crashing, and fixing the cause of that crash. There is no obvious reason why FOP shouldn't be able to cope with any printable character. My guess is that it is something to do with the way you are using FOP ...

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • I have more examples of these characters: ✨, , I do not have an exhaustive list of those that cannot be rendered. I produce a PS/PDF file as an output from the Apache renderer. – KKS Dec 20 '12 at 01:16
  • 1
    The characters in question are *not* system-specific, and deleting them is unlikely to be the best solution. Can you update your question to provide more information about the crash (exact error message, if any)? – Keith Thompson Dec 20 '12 at 01:20