-1

I want extract zip file with utf-8 ,but there not's zipfile.setcharset function in 2.1.2 version.

public void unZipFiles(File zipfile, String descDir) {
    try {
        ZipFile zfile = new ZipFile(zipfile);

        // zfile.setcharset
        zfile.extractAll(descDir);
    } catch (ZipException e) {
        e.printStackTrace();
    }
}
George Z.
  • 6,643
  • 4
  • 27
  • 47

1 Answers1

0

Zip4j v2.x will automatically detect if file names are encoded using utf-8 charset, and if yes, uses it during extraction. This flag (wether to use utf-8 or not) is defined in a zip header parameter.

Zip4j v1.x had the option to define custom charsets, but this lead to zip4j being non-compatible with the standard zip specification, which allows for only two charsets to be used in a zip file, one is cp437 and the other is utf-8.

In short, you do not have to set the charset explicitly in v2.x, this is detected and used automatically by Zip4j if needed.