简体   繁体   中英

Android TextView displays strange text

I have written an application where I need to show in a TexView text coming from the server. I am experiencing a strange behavior when the text is set on the TextView .

For example, I am receiving "español" from server but the Textview display "espacol" is there a way to fix the encoding or perhaps display "spannish" without mapping the texts in the application.

Any help will be greatly appreciated.

You can use String.format() with Locale what you want.

For example;

String text = String.format(Locale.ENGLISH, "%d", item.getText());
textView.setText(text);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM