I have a zip file with the following content:
The content inside Temperature_°C.log : unit°C
and i use the following code to print all the file names inside a zip:
public static void main(String[] args) {
try {
ZipFile zipFile = new ZipFile("Test.zip", Charset.forName("UTF-8"));
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
try {
ZipEntry zipEntry = entries.nextElement();
System.out.println(zipEntry.getName());
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}
zipFile.close();
} catch (IOException ex) {
Logger.getLogger(ZipTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
and at line : ZipEntry zipEntry = entries.nextElement(); for the Temperature_°C.log it throws java.lang.IllegalArgumentException: MALFORMED
I tried UTF-8 and it is not working. When i tried with ISO-8859-1 it displays junk character.
How should i solve this ?
