Add non-ASCII file names to zip in Java

后端 未结 7 1368
时光说笑
时光说笑 2020-12-14 08:38

What is the best way to add non-ASCII file names to a zip file using Java, in such a way that the files can be properly re

7条回答
  •  鱼传尺愫
    2020-12-14 09:31

    You can still use the Apache Commons implementation of the zip stream : http://commons.apache.org/compress/apidocs/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.html#setEncoding%28java.lang.String%29

    Calling setEncoding("UTF-8") on your stream should be enough.

提交回复
热议问题