3

I want to write 'ile' in android TextView but it isn't drawn correctly. How can use characters like this?

For example I set the my textview as 'çile' it shows as '?ile' instead; how can I fix this?

CompEng
  • 7,161
  • 16
  • 68
  • 122

3 Answers3

4

Try the following and see if it helps (source):

String description = "Turkish characters here";
TextView tv = (TextView) findViewById(R.id.description); 
tv.setText(Html.fromHtml(description).toString());
Marvin Pinto
  • 30,138
  • 7
  • 37
  • 54
3

This to me screams: character-encoding issue. A lot of software (eg browsers, database clients) robustly handle unexpected bytes by replacing them with question marks. But Turkish characters are supported by "UTF-8", Android's default charset.

http://developer.android.com/reference/java/nio/charset/Charset.html#defaultCharset%28%29

You may want to start by checking that your charset is indeed set to UTF-8/16 or ISO-8859-9 (Turkish). If that isn't the problem, it could be the font itself.

If that still doesn't solve the problem, I would post a small example of the code you are using to display the text. From file to database to database connection to web browser, there are many places where conversion can happen.

Brian Duncan
  • 1,176
  • 1
  • 13
  • 21
2

This answer solved my problems for turkish characters.

https://stackoverflow.com/a/9312031/218198

Community
  • 1
  • 1
milkersarac
  • 3,399
  • 3
  • 31
  • 31
  • This simple solution did not worked for SDK's 2.3 and 3.2 for me. To cover 2.3, 3.2 and 4.0 I added some more lines: `String htmlData = "Html data with tags and turkish characters";` `String header = "";` `webView.loadData(header+htmlData, "text/html;charset=UTF-8", null);` – milkersarac May 05 '12 at 00:39