output = new ZipArchiveOutputStream(response.getOutputStream());
output.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
response.setContentType(APPLICATION_ZIP);
output.putArchiveEntry(new ZipArchiveEntry("日本語.txt");
// write file to output stream
output.closeArchiveEntry();
But after download the file names are garbled, while the files(file content) are ok.
If I write the zip file to filesystem using FileOutputStream the filenames are retained as is, but only when streaming the file using ServletOutputStream the filename inside the Zip file are garbled.
Is there a workaround for this? Do I need to set character encoding for the output stream too, not sure if that actually is there?