Jump to content

Missing UTF 8 Characters in Jaspersoft 7


Go to solution Solved by Some Company Name,

Recommended Posts

I have been using Jaspersoft Studio 7 and created a text expression that should output a UTF-8 character based on a Boolean value. The default encoding will not print the value and there does not appear to be a UTF-8 encoding available in the drop down. My assumption is that it is outputting UTF-8 by default. Character 'B' or 'A' will print. I feel I am missing something simple.  I saw in older versions people used WingDings, but that doesn't appear to be available in the Studio.  In what direction should I proceed with this?

 

<field name="serviceJasperModel.service" class="java.lang.Boolean"/>
<element kind="textField" uuid="ee599154-57af-4dda-b99f-e86ad669d457" mode="Transparent" x="153" y="56" width="100" height="30" pdfEncoding="">
<expression><![CDATA[$F{serviceJasperModel.service} ? "\u2713 B":"\u2717 A"]]></expression>
</element>

 

  • Like 1
Link to comment
Share on other sites

In the below code when I preview I can see the check mark. You can see this in the attached ss.

<element kind="textField" uuid="c24d9bba-e36f-455e-b649-4d839eb375c5" x="310" y="50" width="100" height="30">
	<expression><![CDATA["\u2611"]]></expression>
</element>

 

However, when I click run the report, the checkbox is no longer visible.

 

Screenshot from 2024-09-17 15-29-42.png

Screenshot from 2024-09-17 15-33-13.png

Link to comment
Share on other sites

  • Solution

So the solution for this comes down to a few things. I cannot find the original official link that discusses this support.  In JR 7 you must use a font that supports unicode characters 2610 and 2611.  DejaVu Sans was specifically created for this and you MUST use THOSE characters. In addition you MUST set the properties below into your report.

 

	<property name="net.sf.jasperreports.export.docx.embed.fonts" value="true"/>
	<property name="net.sf.jasperreports.export.pptx.embed.fonts" value="true"/>
	<element kind="textField" uuid="19b99216-3094-4d7b-aa86-e3a7cc9dab84" x="0" y="-10" width="30" height="30" fontName="DejaVu Sans" fontSize="22.0">
		<expression><![CDATA[$F{serviceJasperModel.service} ? "\u2611":"\u2610"]]></expression>
	</element>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...