Kevin Parker
Kevin Parker

Reputation: 17216

Display unicode characters in android?

I've created a messaging app and am learning a good portion of members don't reside in North America or the UK.

When they post messages only garbled text is returned. All database columns where the data is store is in UTF-8.

Is there a way to properly display UTF-8 Characters that someone has been able to enter? See the screenshot below.

Android screenshot of invalid characters

Upvotes: 8

Views: 2951

Answers (1)

Renaud
Renaud

Reputation: 8873

The simple one: use the appropriate font.

More precisely, the endpoint should have a font which define the unicode characters if you want to display them properly. I don't know if that is possible for android but you should try to embbed a full utf-8 font with your application since you have no idea on what's defined by the resident font (Droid familiy can be replaced by vendors or power user).

Test with the vanilla Droid family first (you can find it on android.git.kernel.org), find a font family redistributable with your application and use it within your application. I have never used that but it seems to me that handcent provide differents font packs (for look'n'feel but certainly for unicode regions).

Renaud

Can be found on the android git repo: − DroidSansArabic.ttf defining the Arabic interval (U+6000-U+06FF 94/250 and more) − DroidSansHebrew.ttf defining the Hebrew interval (U+0590-U+05FF 87/87) … … (checked with fontforge)

Upvotes: 7

Related Questions