Jump to content
JasperReports Library 7.0 is now available ×

Unicode problem


2004 IR Help

Recommended Posts

By: bourridhh - bourridhh

Unicode problem

2005-05-06 00:03

Hi,

For those who have problem with unicode characters and especially with unicode data extracted from database.

 

I found a solution for the problem

I create a method that returns unicode characters from an UTF-8 or ISO string here is:

public class ArabicFormatter {

 

public static String formatString(String inputString) {

try {

return (

EncodeChanger.unicodeEsc2Unicode(

new String(inputString.getBytes("ISO8859_1"), "Cp1256")));

} catch (UnsupportedEncodingException e) {

return "";

}

}

 

}

 

EncodeChanger is part of library that allows conversion from utf-8 to unicode (like u77c)

in my jrxml file

ArabicFormatter.formatString($F{value})

Dont forget the font and the textField encoding:

 

<reportFont name="Arab" isDefault="true" fontName="Tahoma Bold" size="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="c:\tahomabd.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

 

Any one wants the PropertiesEditor.jar that contains EncodeChanger class he can ask me ,i ll give it to him

Hope it helps

thanks

Link to comment
Share on other sites

  • 3 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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...