Skip to content

Commit d80df16

Browse files
#403 Use utf-8 by default when reading zip file names
1 parent ed9eed5 commit d80df16

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

src/main/java/net/lingala/zip4j/headers/HeaderUtil.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
import net.lingala.zip4j.model.ZipModel;
66
import net.lingala.zip4j.util.InternalZipConstants;
77

8-
import java.io.UnsupportedEncodingException;
98
import java.nio.charset.Charset;
109
import java.util.ArrayList;
1110
import java.util.List;
1211

1312
import static net.lingala.zip4j.util.InternalZipConstants.ZIP4J_DEFAULT_CHARSET;
14-
import static net.lingala.zip4j.util.InternalZipConstants.ZIP_STANDARD_CHARSET_NAME;
1513
import static net.lingala.zip4j.util.Zip4jUtil.isStringNotNullAndNotEmpty;
1614

1715
public class HeaderUtil {
@@ -41,11 +39,7 @@ public static String decodeStringWithCharset(byte[] data, boolean isUtf8Encoded,
4139
return new String(data, InternalZipConstants.CHARSET_UTF_8);
4240
}
4341

44-
try {
45-
return new String(data, ZIP_STANDARD_CHARSET_NAME);
46-
} catch (UnsupportedEncodingException e) {
47-
return new String(data);
48-
}
42+
return new String(data, ZIP4J_DEFAULT_CHARSET);
4943
}
5044

5145
public static byte[] getBytesFromString(String string, Charset charset) {

0 commit comments

Comments
 (0)