Skip to content

Commit

Permalink
Use charset for filename length
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanth-lingala committed Oct 19, 2019
1 parent b387955 commit 83d19b9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public FileHeader generateFileHeader(ZipParameters zipParameters, boolean isSpli

String fileName = validateAndGetFileName(zipParameters.getFileNameInZip());
fileHeader.setFileName(fileName);
fileHeader.setFileNameLength(determineFileNameLength(fileName));
fileHeader.setFileNameLength(determineFileNameLength(fileName, charset));
fileHeader.setDiskNumberStart(isSplitZip ? currentDiskNumberStart : 0);

if (zipParameters.getLastModifiedFileTime() > 0) {
Expand Down Expand Up @@ -161,7 +161,7 @@ private AESExtraDataRecord generateAESExtraDataRecord(ZipParameters parameters)
return aesExtraDataRecord;
}

private int determineFileNameLength(String fileName) {
return fileName.getBytes(InternalZipConstants.CHARSET_UTF_8).length;
private int determineFileNameLength(String fileName, Charset charset) {
return fileName.getBytes(charset).length;
}
}

0 comments on commit 83d19b9

Please sign in to comment.