I have a listView which is populated by data from an SQLite database. One of my fields is a marker with a unicode character of either a full circle: \u25cf or open circle: \u25cb. Both characters display properly when I use a hardcoded string in a text field. However, in my listView I am seeing the text encoding instead of the character.
Does anyone know why this is… and how I get the unicode characters to display?
Thanks.
Update:
The insertion code is
private void loadRecords() throws IOException {
final Resources resources = mContext.getResources();
InputStream inputStream = resources.openRawResource(R.raw.records);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
try {
String line;
while ((line = reader.readLine()) != null) {
String[] strings = TextUtils.split(line, ",");
if (strings.length <2) continue;
long id = addRecord(strings[0].trim(),strings[1].trim(),strings[2].trim(),strings[3].trim(),
strings[4].trim(),strings[5].trim(),strings[6].trim());
}
} finally {
reader.close();
}
}
with the resource being a csv file with one line being e.g.
primaryKey,name,surname,address,phone,email,\u25CB
In your text file,
\u25CBare six characters.To correctly use Unicode characters, put them directly into the file:
However, you must ensure that the .csv file has the same encoding as that used by your
InputStreamReader(set the second parameter of its constructor).