luk492
luk492

Reputation: 368

Android encoding a string and display in textView

I have an array of strings which are in latin and have some letters which are turned into "?", I need them to display correctly.

String[] asd= {"Srećni nikad ne razmišljaju o sreći."};

in "asd" I have strings which I need to display correctly in TextView on my android device, but every "ć", "š" turns into "?".

textView.setText(asd[0]);

I am using Android Studio. Thanks

Upvotes: 0

Views: 2693

Answers (3)

Bojan Kseneman
Bojan Kseneman

Reputation: 15668

You are supposed to put strings like that into your XML and get them from there. It's a good idea too, since that allows you to have several languages, yet using the same code. Read more here

Upvotes: 0

Mohamed
Mohamed

Reputation: 791

In Android Studio there is two options for encoding you need to check

1- your project encoding
2- your IDE encoding
you will find them under setting
enter image description here


Please make sure also not to hard code any strings you have to put them in string xml files

Upvotes: 2

Ashtaroth
Ashtaroth

Reputation: 47

Try using Unicode, here is a table for your convenience ; http://unicode-table.com/en/#00E8

And chech this question, it may help;

Unicode characters not displayed in TextView.setText

Upvotes: 0

Related Questions