Search code examples
javacsvapache-commons-csv

How to parse a csv file encoded in GB18030 with Apache Commons CSV


I have a csv file encoded with GB18030, and I want to use apache commons CSV to parse the file and get the chinese characters inside the file.

How to do this? as I got some wired character using default configuration.

Thanks


Solution

  • It turns out not a Apache Commons CSV package problem. It's java IO reader problem.

    InputStreamReader isr = new InputStreamReader(new FileInputStream(file), Charset.forName("GB18030"));
    

    Using specified charset when read file using java would help.