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

前端 未结 3 1760
太阳男子
太阳男子 2021-02-06 18:03

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 \'

相关标签:
3条回答
  • 2021-02-06 18:29

    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());
    
    0 讨论(0)
  • 2021-02-06 18:30

    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.

    0 讨论(0)
  • 2021-02-06 18:47

    This answer solved my problems for turkish characters.

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

    0 讨论(0)
提交回复
热议问题