Jaspersoft Studio:UTF-8 编码问题

Jaspersoft studio: UTF-8 encoding issue

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

我还需要配置更多的东西吗?

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

我想我找到了一个更简单、更通用的解决方案。您可以使用 Web 应用程序控制器中的 java 编码,而不是更改每个字段的编码。以下是我的解决方案,希望对您有所帮助。只需将字体放入您的 webapp 文件夹即可。并以编程方式更改编码。顺便说一句,来自土耳其的问候:)

    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();