Carl K.
Carl K.

Reputation: 457

Android: Display Special Characters

I would like to display special characters such as: ṁ ṭ m ē. In case they don't display here as well, this is how the four characters should look like: Display of special chars

In Android, these will display in squares. For other scripts, I am able to come over this problem with using a different font. But in this case setting the font (TextView.setTypeFace) will not solve this issue. These characters display correctly in for example OpenOffice (using Arial or Courier New), but inside Android it doesn't even when using the same fonts).

I also tried having the string saved as a unicode encoded string (e.g. in strings.xml: \u1E41 \u1E6D) getting the same result (in the logs they appear as they should). Any ideas?

Upvotes: 4

Views: 4580

Answers (2)

Carl K.
Carl K.

Reputation: 457

It was really only a font issue. It was just hard to find a font that supports all characters I need.

Seeing that Google Translate has no problems with transliteration characters motivated me to make a more thorough search for fonts. Below is a list of useful fonts for this purpose:

Upvotes: 2

Yojimbo
Yojimbo

Reputation: 24256

If these characters are representable in Unicode, then you should be able to use Html.fromHtml() to get the glyph into a TextView, e.g.

textView.setText(Html.fromHtml("Ӓ"), TextView.BufferType.SPANNABLE);

Upvotes: 4

Related Questions