Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display unicode characters in android?

Tags:

java

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

like image 953
Kevin Parker Avatar asked Feb 26 '11 19:02

Kevin Parker


People also ask

How do I display Unicode?

Inserting Unicode characters To insert a Unicode character, type the character code, press ALT, and then press X. For example, to type a dollar symbol ($), type 0024, press ALT, and then press X.

Does Unicode Work Android?

Android UnicodeMap lets you browse Unicode characters by range and search for them by name, display them (when Android has the font) and copy them to the clipboard. It can also decode a string of Unicode characters to names.

How do I find my Unicode?

Step #1 Copy and paste a text message into the empty box. Characters will automatically be displayed in the results box. Step #2 Identify the different symbols in your SMS message. GSM characters will be displayed in grey, Unicode characters will appear in red and escape characters will be displayed in orange.


1 Answers

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)

like image 176
Renaud Avatar answered Oct 16 '22 05:10

Renaud