I’m writing an android application and I have issue with edit text.
When the user adds text with accent (sp: “Nous sommes en été”);
The string isn’t correct. It convert my accent symbole to utf-8 I guess.
How can I deal with it ?
ps: my application is a french app and I really need to use accent.
MY CODE :
String description = ((EditText) findViewById(id.description)).getText().toString();
Log.i("UTF8",description.toString());
description = description.replace("\n", "");
Log.i("UTF8",description.toString());
There shouldn’t be a problem. String representations are UTF-16 [1] in java / android. I tried the following code on android and got it to work fine. The accented é displays correctly.
You know that the first parameter in your Log.i() code is a tag right ? Log.i() does not accept encoding type as a parameter. Can you post what those statements print ?
[1] – http://docs.oracle.com/javase/7/docs/api/java/lang/String.html