How can I use Turkish characters like 'ş ç ı ö' in an Android TextView?

有些话、适合烂在心里 提交于 2020-01-01 00:48:14

问题


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?


回答1:


This answer solved my problems for turkish characters.

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




回答2:


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());



回答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.



来源:https://stackoverflow.com/questions/9069716/how-can-i-use-turkish-characters-like-%c5%9f-%c3%a7-%c4%b1-%c3%b6-in-an-android-textview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!