I am working with opencsv(2.3), i create the header of the csv from the properties file which contains special chracters.
I encode using UTF-8 and set the property as a header to csv.
But I still see CSV file created doesnt reflect the encoding.
(I used the same approach to create PDF using jasperreports, there i could see the columns with special characters are encoded well and shown properly)
Java version : 7
properties file content: (é is getting stored as é and ü is stored as ü)
lan.response=Nombre de réponses
lan.exef=Exécution
lan.exeg=Ausführung
Approach using csv:
/* properties file*/
 final File  propertiesFile = new File(System.getProperty("user.home"), "tmp/lan.properties");
 final FileInputStream fis= new FileInputStream(propertiesFile);
 final InputStreamReader inputStreamReader = new InputStreamReader(fis, "UTF-8");
 final Properties properties= new Properties();
 properties.load(inputStreamReader);
 properties.list(System.out);
 /*CSV Header*/
 StringBuilder header = new StringBuilder();
 header.append(properties.get(lan.response)).append(",");
 header.append(properties.get(lan.exef)).append(",");
 header.append(properties.get(lan.execg));
 String[] colHeader = header.split(",");
  FileOutputStream fos =  new FileOutputStream(fileName);
  Writer fw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
  CSVWriter csvWriter = new CSVWriter(fw, ";");
  // add header
  csvWriter.writeNext(colHeader);
  // add data 
  String[] col= new String[3];
   for(Customer c : customerList) {
         col[0] = c.getCustomerName();
         col[1] = c.getCustomerId();
         col[2] = c.getCustomerBirthDate();
         csvWriter.writeNext(col);
   }
   csvWriter.close();
Can anyone please help me as I am able to see the special characters in other file formats(Ex: PDF) not in CSV?
 
    