I am having a problem in exporting a csv file using au.com.bytecode.opencsv.CSVWriter
. I did something like:
File file = File.createTempFile("UserDetails_", ".csv");
CSVWriter writer = new CSVWriter(new OutputStreamWriter(
new FileOutputStream(file), "UTF-8"),
',');
and then when I exporting the .csv file, it shows the junk characters for french letters.[Data to be saved in the .csv are french characters]. But previously I was doing something like:
CSVWriter writer = new CSVWriter(new FileWriter(file));
, then it was perfectly showing all french characters in Windows environment, but in Prod environment[Linux] it was showing junks. So I thought to use the Character set UTF-8
for the file format to be exported.
How can I get rid of the problem? Please Suggest!! Thanks in advance!