0

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

4
  • This is supposed to work. Android is unicode so this means č š ž ć đ should work normally. Have you tried setting it from you XML? Commented May 1, 2015 at 20:15
  • Dont know why, but it doesnt work...How do I do that in xml? thanks Commented May 1, 2015 at 20:21
  • 1
    Read this developer.android.com/guide/topics/resources/… Commented May 1, 2015 at 20:26
  • Yeah that worked, I changed the way I was doing things to xml resource and then pulling data from there. Thanks Commented May 1, 2015 at 20:35

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.