ZipInputStream Throws Illegalargument exception for diacritics
Hi,
If I run the below program with the zip file which has some files with diacritic characters (e.g 1-2GF-969##JÖN.pdf) , I get IllegalArgumentException.
My application has to support all languages. So, we set encoding to UTF-8
All languages work fine. But the problem comes when reading diacritic characters.
I tried using alternatives to zip input stream, like arcmexer, but it does not support Chinese characters.
Please help me with this.
private static void readUsingJava() {
ZipInputStream zis;
try {
zis = new ZipInputStream(new FileInputStream("C:\\Check.zip"));
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
System.out.println("Name of the File Is :: " + ze.getName());
}
zis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Re: ZipInputStream Throws Illegalargument exception for diacritics
Re: ZipInputStream Throws Illegalargument exception for diacritics
Re: ZipInputStream Throws Illegalargument exception for diacritics
Thanks a lot sir.
We are using web logic 9 and it does not have support for JDK7 .
i tried apache commons compress. It works fine for diacritics but it does not support chinese chars. :-)
Here we can specify encoding format.
This fails for chinese characters. Does not throw exception, but the characters are not displayed correctly.
ZipArchiveInputStream zin = new ZipArchiveInputStream(name, "UTF-8", true);
org.apache.commons.compress.archivers.zip.ZipArchi veEntry entry = null;
log.debug("Inside getTotalNoOfFilesinZip");
while((entry = zin.getNextZipEntry()) != null)
{
entry.getName() //Obtain name of the file
}
Re: ZipInputStream Throws Illegalargument exception for diacritics
Re: ZipInputStream Throws Illegalargument exception for diacritics
Hi Darryl,
Thanks a lot for your help.
This works fine with Apache commons compress and Winzip - latest version - 14.5.
I tried with evaluation version of WinZIP.
We have got license for Winzip 9 only. It does not work with Winzip 9 and apache :-)
So, I'm trying to find some alternative solutions. If you know, kindly help.