List<String> list_code = null;
方案1 控制字符集:
BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName),"Shift_JIS"));
CSVPrinter printer = new CSVPrinter(bw, CSVFormat.EXCEL);
方案2 默认字符集utf8:
CSVPrinter printer = new CSVPrinter(new FileWriter(fileName),CSVFormat.EXCEL);
写入
printer.printRecord("id", "userName", "firstName", "lastName", "birthday");
printer.printRecord(list_code);
//bw.close();
printer.close();