Apache FOP 0.95可以渲染表情符号吗?

时间:2012-12-20 00:54:43

标签: java utf-8 apache-fop

我们正在使用Apache FOP 0.95渲染系统,并且渲染引擎在遇到UTF-8表情符号时崩溃。我正在使用Java将数据呈现为PS / PDF格式。

有没有办法正确渲染它们或过滤这些不可渲染的字符?

以下是例外情况:     在org.apache.xalan.templates.FuncDocument.warn(FuncDocument.java:419)     在org.apache.xalan.templates.FuncDocument.getDoc(FuncDocument.java:356)     在org.apache.xalan.templates.FuncDocument.execute(FuncDocument.java:192)     在org.apache.xpath.Expression.bool(Expression.java:184)     在org.apache.xpath.XPath.bool(XPath.java:410)     在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)     在org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:308)     at org.apache.xalan.templates.XUnresolvedVariable.execute(XUnresolvedVariable.java:124)     在org.apache.xpath.VariableStack.getGlobalVariable(VariableStack.java:446)     在org.apache.xpath.operations.Variable.execute(Variable.java:212)     在org.apache.xpath.operations.Variable.execute(Variable.java:186)     在org.apache.xalan.templates.FuncDocument.execute(FuncDocument.java:77)     在org.apache.xpath.XPath.execute(XPath.java:335)     在org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:278)     at org.apache.xalan.templates.XUnresolvedVariable.execute(XUnresolvedVariable.java:124)     在org.apache.xpath.VariableStack.getGlobalVariable(VariableStack.java:446)     在org.apache.xpath.operations.Variable.execute(Variable.java:212)     在org.apache.xpath.operations.Variable.execute(Variable.java:186)     在org.apache.xpath.axes.WalkingIterator.setRoot(WalkingIterator.java:154)     在org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:213)     在org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:210)     在org.apache.xpath.XPath.execute(XPath.java:335)     在org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:278)     在org.apache.xalan.templates.ElemVariable.execute(ElemVariable.java:246)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:392)     在org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:246)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:392)     在org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:246)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:392)     在org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:246)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:392)     在org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:246)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemIf.execute(ElemIf.java:160)     at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:393)     在org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:176)     at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2411)     在org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1374)     at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:393)     在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)     在org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1367)     在org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:709)     at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284)     在org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262)

1 个答案:

答案 0 :(得分:1)

你没有说出不想要的字符是什么......

String.replaceAll()方法是摆脱字符串中不需要的字符的好方法。

但另一个问题是知道这些不可退出的角色是什么。此外,这些字符由Unicode标准定义......它们在含义上不是系统特定的。


我认为你最好搞清楚为什么 FOP崩溃,并解决崩溃的原因。 FOP不应该能够处理任何可打印的角色是没有明显原因的。我的猜测是,这与你使用FOP的方式有关...