Reputation: 1645
My code not working when compare text UTF-8:
String a="Mão";
String getTimeGioAm(String a)
{
String time="";
if (a.equals("Mão")) {
time = "6-8";
}
return time ;
}
result: time=""
How compare text UTF-8 in android?
Upvotes: 3
Views: 717
Reputation: 3257
String a="Mão";
String aux_a = new String(a.getBytes("UTF-8"), "UTF-8");
String time="";
if (someString.equals(aux_a)) {
time = "6-8";
}
An interesting discussion about UTF-8 strings here
Upvotes: 1