3

I have created a text view . there are various language character used. some character appearing at some place but not some place in text view. what may be reason.

1
  • 1
    do you use strings.xml? Or is this insert in code directly?
    – Oli
    May 29, 2013 at 7:24

3 Answers 3

3

Unfortunately, you just can't do it that way from strings.xml AFAIK.

You're left doing one of two things.

Adding the Unicode character within java to the String in the XML file:

String str = "\u00A9" + getContext().getString(R.string.your_string);

Entering the text as HTML in java:

yourTextView.setText(Html.fromHtml("your chars");

Hope this is useful.

Reference Unicode characters not displayed in TextView.setText

3

Try this I hope this will work.

myTextView.setText(Html.fromHtml("your_string"));
1

I faced a similar issue when setting a textview with content from a .txt file loaded from my assets folder.

I tried a few things to mess with the encoding, but without result.

In the end the problem turned out not to be related to my Android code but to the text file that got loaded in. Apparently notepad could not handle the copy past html. When recreating the text-file with a custom editor (I used Sublime) the "?" on ë, ä, ù, ... got resolved to the correct character in my TextView.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.