java 解析csv文件例子,csv文件 中文乱码问题 客官°小女子只卖身不卖艺 2022-08-26 11:07 180阅读 0赞 java 解析csv文件例子,采用了第三方包,csv文件 中文乱码问题 解析方法: public List resolveCsv(String csvFileName) \{ CSVReader reader = null; String\[\] nextLine = null; List resolve = new ArrayList(); try \{ reader = new CSVReader(new FileReader(csvFileName)); while ((nextLine = reader.readNext()) != null) \{ if (nextLine != null) \{ resolve.add(nextLine); \} \} \} catch (FileNotFoundException e) \{ e.printStackTrace(); \} catch (IOException e) \{ e.printStackTrace(); \} return resolve; \} 附件中是 第三方包的源码,我有改动, 改动的地方:由原来的输入一个Reader 改成了,输入参数变为文件路径,这样解决了csv文件 中文乱码问题 * [au.rar][] (15.4 KB) * 下载次数: 114 [au.rar]: http://dl.iteye.com/topics/download/de6bea60-b342-371d-9045-a725aa3954e5
还没有评论,来说两句吧...