Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Java in General
Problem unzipping with ZipInputStream, containing filename with Swedish characters
Markus Källander
Greenhorn
Posts: 15
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I am having problems unzipping an archive that contains a file with a Swedish character in the filename. Here is the error message:
java.lang.IllegalArgumentException at java.util.zip.ZipInputStream.getUTF8String(ZipInputStream.java:299) at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:238) at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:73)
...and here is the code:
public static void unzip(File zipfile) throws IOException, InsiderFileParseException { BufferedOutputStream dest = null; FileInputStream fis = new FileInputStream(zipfile); ZipInputStream zin = new ZipInputStream(new BufferedInputStream(fis)); ZipEntry entry; while ((entry = zin.getNextEntry()) != null) { int count; byte data[] = new byte[BUFFER]; String destFile = zipfile.getParent()+"/" + entry.getName(); FileOutputStream fos = new FileOutputStream(destFile); dest = new BufferedOutputStream(fos, BUFFER); while ((count = zin.read(data, 0, BUFFER)) != -1) { dest.write(data, 0, count); } dest.flush(); dest.close(); } }
Any ideas what to do anybody? When I remove the file with the Swedish character from the zip this works fine.
Thanks
Markus
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Getting zip exception while decompressing a compressed file
Exception
need help with zip decompression
need help with zip extraction
Problem in unzipping a folder using java.util.zip API
More...