I wrote an application on Android using Java, so users can answer questions, which are then saved to a file.
The problem is that this file is saved in UTF8
.
The end user will open this file in IBM SPSS
which is a Windows application and will only read files in ANSI
(Windows-1252).
How do I create files in ANSI
to save to memory card in my Java-Android application?
To convert Strings to ANSI
I should use:
String unicode = new String(asciiBytes, "windows-1252");
Is this correct?
My old code to save the file is:
File interviewFile = new File(placeOfSDD, fileName);
FileWriter writer = new FileWriter(interviewFile, true);
writer.append(textBody);
writer.flush();
writer.close();
"textBody" is the String to convert to ANSI
, and "interviewFile" is the file to save as ANSI
as well.
Already to read a file in ANSI
and convert it to String with UTF8
, how do I?