2 Replies Latest reply on Jan 26, 2013 1:11 PM by Dimitar Dimitrov

    Read and write a .CSV file contains cirillic characters issue

      Hi guys,
      I am a developer of a web application project which uses Oracle Fusion Middleware technologies. We use JDeveloper as development IDE.
      I have a requirement to get a .csv file from WLS to application running machine. I used a downloadActinLinsener in front end .jspx in order to do that.
      I use OpenCSV library to read and write .csv files.
      Here is my code for read and write the .csv file,
      public void dwdFile(FacesContext facesContext, OutputStream out) {

      String [] nextLine;

      try {
      FileInputStream fstream1 = new FileInputStream("Downloads/filetoberead.CSV");
      DataInputStream in = new DataInputStream(fstream1);
      BufferedReader br = new BufferedReader(new InputStreamReader(in,"UTF-8"));
      CSVReader reader = new CSVReader(br,'\n');
      //CSVReader reader = new CSVReader(new FileReader("Downloads/ACTIVITY_LOG_22-JAN-13.csv"),'\n');
      List<String> list=new ArrayList();
      while ((nextLine = reader.readNext()) != null) {

      if(nextLine !=null){
      for(String s:nextLine){
      System.out.println("list size ; "+list.size());
      OutputStreamWriter w = new OutputStreamWriter(out, "UTF-8");
      CSVWriter writer = new CSVWriter(w, ',','\u0000');
      for(int i=0;i<list.size();i++){
      System.out.println("list items"+list.get(i));
      String[] entries = list.get(i).split(",");
      //System.out.println("list items : "+list.get(i));
      } catch (IOException e) {


      say the filetoberead.CSV contains following data,
      1,111211,LI,0,TABO,B,M002500003593,,,К /БЭ60072715/,КАРТЕНБАЙ
      2,07,Balance Free,3
      1,383708,LI,0,BDSC,B,НЭ63041374,,,Т /НЭ63041374/,ОТГОНБААТАР
      2,07,Balance Free,161

      It reads and writes the numbers and english characters correct. All cirillic characters it prints "?" as follows,
      1,111211,LI,0,TABO,B,M002500003593,,,? /??60072715/,?????????
      2,07,Balance Free,3
      1,383708,LI,0,BDSC,B,??63041374,,,? /??63041374/,???????????
      2,07,Balance Free,161


      can somone please help me to resolve this problem?

      Regards !