I tried the program below to write data from the DB to a CSV file. When I open the CSV file, it's displaying junk values for Spanish special characters.
public class T {
CSVWriter out = null;
private void write(String[] values) throws IOException {
out.writeNext(values);
}
public static void main(String[] args) throws IOException {
File f = new File("s.csv");
FileOutputStream os = new FileOutputStream(f, false);
os.write('\ufeff');
CSVWriter out = new CSVWriter(
new BufferedWriter(
new OutputStreamWriter(
os, "UTF-8")));
}
}