How to show phonetic (IPA) characters on Android

I am trying to display phonetic characters in a WebView , but for now I am getting squares.

For example, for the word "apostrophe" this should be displayed:

əpåstrəfi

but all I get on the display is:

□□ påstr □ c

If this helps, I get the rows from the SQLite database. There are some HTML tags in the line I get, so I use this:

 webView.loadDataWithBaseURL("file:///android_asset/", article, "text/html", Encoding.UTF_8.toString(), null); 

where I have CSS files in /assets . And the article variable contains text enclosed in HTML tags.

+6
android encoding unicode special-characters webview
source share
2 answers

I solved the problem of displaying phonetic characters in a TextView. The problem is that the default fonts for Android do not implement IPA characters. I can advise using ccs like this

 @font-face { /* Regular */ font-family: "ConstructiumRegular"; src: url("http://openfontlibrary.org/content/RebeccaRGB/412/Constructium.ttf") format("truetype"); font-weight: 400; font-style: normal; font-variant: normal; font-stretch: normal; } 

In my case, the mentioned Constructium.ttf is suitable.

+2
source share

If you pick up a font in the form of Unicode, for example Gentium , and you make sure that you can change your font with a utility such as this , you should be good to go. I do not have Android, so there may be problems with the types of fonts that can be installed. You may need to check this out, or the font installer I provided may not work for you. Ymmv

0
source share

All Articles