In my Android application I create a TSV file and I send it via e-mail. When I try to open it using Excel it detects it as ANSI, so some of my characters aren't seen as they should. I have another application not created by me that does the same, but Excel detects it as UTF-8. I've checked the HEX code of both files and I found that he uses C2 A0 in some of his spaces (not tabs), while I use 20.
This is the code I use to create the file:
FileOutputStream writeFileHandler = context.openFileOutput(LOG_FILENAME_CSV, Context.MODE_WORLD_READABLE);
OutputStreamWriter oputStreamWriter = new OutputStreamWriter(writeFileHandler, "UTF-8");
for(int i=log_rows.length-1; i>=0; i--){
String[] entries = getDailyLogEntries(log_rows[i]); // array of your values
for(int j=0; j<entries.length; j++){
if(j==0) oputStreamWriter.write(entries[j]);
else{
if(entries[j] != null) oputStreamWriter.write("\t"+entries[j]);
}
}
oputStreamWriter.write("\n");
}
oputStreamWriter.flush();
oputStreamWriter.close();
writeFileHandler.close();
I tried to pull the file using DDMS to avoid the e-mail sending and the result is the same, it's detected as ANSI. How can I do it so Excel detects it as UTF-8?
Thanks!