Display UTF-8 characters in TextView

Do I need to do something to display UTF-8 characters in a TextView?

I am trying to display the following characters:

ื–ื•ื’, ืœืžื˜ืจื•ืช ืจื•ืžื ื˜ื™ื•ืช, ืžื™ื ื™ื•ืช ืื• ืื—ืจื•ืช, ื‘ื”ืชืื ืœื”ืขื“ืคื•ืชื™ื”ื. ืืชืจื™ ื”ื™ื›ืจื•ื™ื•ืช ืžื›ื™ืœื™ื ืžืื’ืจ ืžื™ื“ืข ื”ื›ื•ืœืœ ืคืจื•ืคื™ืœ ืื™ืฉื™ ืฉืœ ืžื ื•ื™ื™ื. ื›ืœ ืื“ื ื”ืžืขื•ื ื™ื™ืŸ ืœื”ืฆื˜ืจืฃ ืœืฉื™ืจื•ืช, ืžืžืœื ื˜ื•ืคืก ื”ืจืฉืžื” ื‘ืืชืจ ื•ื™ื•ืฆืจ ืœืขืฆืžื• ืคืจื•ืคื™ืœ.

If I use Log.d(TAG, text)where it textcontains the characters that I'm going to display, it correctly displays the output of logcat. If I then use textview.setText(text), all that is displayed in the TextView is fields.

From what I read, many of these fonts, such as Hebrew, etc., are not supported by Android, however, if I send myself an email with these characters, they display correctly in the Gmail and Tiwtter applications.

How can I correctly display these characters?

UPDATE:

I installed the AnySoftKeyboard application and the Hebrew language pack, and suddenly my application will be able to display Hebrew. If I remove both of them, my application can still display Hebrew. That makes no sense to me.

+3
source share
1 answer

The problem is with installing fonts.

If the font used does not have a Hebrew alphabet, you will see everything that fon't use for its default character (i.e. box).

As far as I know, all Android distributions do not have a Hebrew font installed by default, so AnySoftKeyboard has a Hebrew language pack that installs a font with the Hebrew alphabet.

+3
source

Source: https://habr.com/ru/post/1753094/


All Articles