vendredi 22 avril 2016

Special chars like Umlaute are not saved correctly in android sqlite database

I can't save special characters like umlaute (e.g. Ä,Ü,ö, etc.) using sqlite in Android. Typing "ä" results in "\u00E4".

I've already tried following code to save a string in database, but didn't help:

ContentValues values = new ContentValues();

String content = comment.getContent().toString();
byte[] chars = content.getBytes("UTF-8");
String utf8Content = new String(chars, "UTF-8");

values.put(DBHandler.CONTENT,utf8Content);

Aucun commentaire:

Enregistrer un commentaire