Suresh Basina
Suresh Basina

Reputation: 185

How to display arabic characters getting from the database when user changes language option in blackberry application?

In my Blackberry application, I have to change the screen to arabic when user changes his language to arabic from settings page. I am getting arabic string data from the database and displaying it on the screen. In simulator it is displaying correctly. But in device (Blackberry curve 8900) it displaying as '????????'. How do I make it display correctly?

Upvotes: 1

Views: 820

Answers (2)

Hesham
Hesham

Reputation: 5274

Try converting your strings to UTF-8 after you load them from the database.

String arabicText = new String(getStringFromYourDB().getBytes(), "UTF-8");

Upvotes: 0

Michael Donohue
Michael Donohue

Reputation: 11876

It is likely a font issue on the device you are testing with. Try browsing an arabic web page from that same device. Are you able to see the right characters in that case? The browser should be subject to the same font restrictions as your app, so this is a reasonable test.
Another thing to check is whether you can select arabic as the device language from the settings screen.

If these two things aren't possible, then the device isn't setup for arabic. You will want to plug into the BlackBerry Desktop app, and do a system software update to add Arabic fonts to the device.

EDIT

Apparently this is not a font issue, since resource strings display correctly. You must have an encoding problem somewhere in the database. Are the arabic strings inserted by your app, or is the database loaded elsewhere and copied into the app? Check what encoding is used when inserting the strings.

Upvotes: 1

Related Questions