Jaspersoft工作室:UTF-8编码问题

问题描述 投票:1回答:2

我使用的是Jaspersoft Studio最终版本(v6.1.1)。我设计了我的报告,它包含土耳其语字符。从Studio导出报表时,尽管我已将Studio工作区编码设置为UTF-8,但未显示土耳其语字符。我还在我的JSF应用程序中嵌入了jrxml报告文件并导出报告,结果是一样的。

我是否需要配置更多内容?

java encoding utf-8 jasper-reports jaspersoft-studio
2个回答
2
投票

我能够解决问题。在Jaspersoft Studio IDE中,在Window / Prefrences / General / Workspace中将编码更改为UTF-8。然后单击IDE中的任何字段,参数或文本,从Properties / Advanced菜单中选择PDF / PDF Encoding。我希望它会有所帮助。


0
投票

我想我找到了一个更简单,更通用的解决方案。您可以使用Web应用程序控制器中的java编码来代替更改每个字段的编码。以下是我的解决方案,我希望它有所帮助。只需将字体放入webapp文件夹即可。并以编程方式更改编码。来自火鸡的BTW问候:)

    JRDesignStyle jrDesignStyle = new JRDesignStyle();
    /*Set the Encoding to UTF-8 for pdf and embed font to arial*/
    jrDesignStyle.setDefault(true);
    String fontPath = req.getSession().getServletContext().getRealPath("/jasper/arial.ttf");
    jrDesignStyle.setPdfFontName(fontPath);
    jrDesignStyle.setPdfEncoding("Identity-H");
    jrDesignStyle.setPdfEmbedded(true);
    jasperPrint.addStyle(jrDesignStyle);

    JRPdfExporter exporter = new JRPdfExporter();
© www.soinside.com 2019 - 2024. All rights reserved.