Reputation: 7216
I have an Android app where I need to output some characters shich are not ASCII. My Java file where I set those characters is encoded as UTF-8:
public void onItemCheckedStateChanged(ActionMode mode, int position,
long id, boolean checked) {
mode.setSubtitle(llista.getCheckedItemCount() + " elements sel·leccionats.");
}
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.setTitle("Sel·lecciona!");
MenuInflater inflater = mode.getMenuInflater();
if (inflater != null) {
inflater.inflate(R.menu.menudetallllista, menu);
}
return true;
}
But the output I get is this:
Is there any way to fix this besides changing the file Encoding to Windows-1252?
Upvotes: 0
Views: 887
Reputation: 2033
One work around is to unicode escape the chars in the Java source:
((TextView) findViewById(R.id.textView1)).setText("Some chars: \u00BF \u00EC \u00E1 \u00E9 \u00ED \u00F3 \u00FA \u00FC \u00F1");
or the strings XML file:
<string name="test">Again: \u00BF \u00EC \u00E1 \u00E9 \u00ED \u00F3 \u00FA \u00FC \u00F1</string>
Upvotes: 1