Jasper report in displaying arabic

2019-08-15 21:34发布

问题:

This is my xml tag for jasper

<textField>
    <reportElement x="56" y="0" width="276" height="20" uuid="952b2fc3-7220-40ed-80eb-e2a3b9fd9fe2"/>
    <textElement>
        <font fontName="DejaVu Sans" pdfFontName="Courier" pdfEncoding="Cp1256" isPdfEmbedded="true"/>
    </textElement>
    <textFieldExpression><![CDATA[new String($F{TEST}.getBytes(), "UTF-8")]]></textFieldExpression>
</textField>

Input:

واحد مائة أَلْفٌ درهم اماراتي

Output: واحد مائة ?? درهم اماراتي

We can see two question marks in place of arabic character that stands for 1000.

How to display this?
Where I am wrong?

回答1:

I only use Arial Unicode to handle Arabic. I see you are using DejaVu Sans.