Reputation: 78
So I have an object that contains a couple of strings. the text in this string sometimes contains special characters like ë,ô, é, etc...
Now when I set the text in my TextView to show what is inside the string it does show the text but replaces all the special characters with ?
Any ideas how to fix this?
Note the textView is used as an listitem for a listview, and the data is extracted from a .csv file.
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#DBBD59"
android:textColor="#666666"
android:gravity="center"
android:textSize="10pt">
</TextView>
Upvotes: 1
Views: 1121
Reputation: 14398
These are latin fonts which are not supported for your device.
So use custom latinfont ttf to show these font.
TextView textView = (TextView) rowView.findViewById(R.id.yourtextviewfromXml);
Typeface font = Typeface.createFromAsset(getContext().getAssets(), "latin_font_ttf_file.TTF");
textView.setText("ë,ô, é");
textView.setTypeface(font);
Note: save ttf file in assets folder.
This post may help you How to display Latin-1 characters in Android app
Upvotes: 2
Reputation: 324
try to replace your special characters with their unicode.
for example replace é with &\#223
See this http://www.codetable.net/unicodecharacters for more information
Upvotes: 0