How to display five-digit Unicode characters like speaker / u 1f50a in android

The unicode 1f50a speaker icon is 5 digits from the Miscellaneous Symbols and Pictograms family, and when I try to display it, I get "a", so apparently I get 1f50 (which does not exist so empty), followed by "a" . I can display any four-digit Unicode character, but I cannot find how to display longer ones. I know that a tablet can display it as I see it in a Unicode Map application.

textSound = (TextView)findViewById(R.id.textSound); textSound.setText("\u1f50a"); 

I searched both Google and SO but cannot find anything that works.

Allen

+7
android unicode
source share
1 answer

These characters cannot be represented directly in the Java string, since it uses only 16 bits per character. But there is an elusive mechanism called "surrogate pairs." For example, the character number 1f50a may be represented by two 16-bit characters D83D and DD0A. So something like "\ uD83D \ uDD0A" might work (I haven't tried it). It depends on whether this character is available in the font used.

This site can help with the conversion.

+8
source share

All Articles