-
Bug
-
Resolution: Fixed
-
P2
-
1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.4.0, 1.4.0_01, 1.4.1, 1.4.1_08, 1.4.2, 5.0, 5.0u4, 6u5
-
b57
-
generic, x86, sparc
-
generic, solaris_8, windows_98, windows_nt, windows_2000, windows_2003, windows_xp
I try to create a ZIP archive containing files, provided that the filenames are french words (ie with accentuated characters). The filenames are contained in String, this means they are encoded in Unicode. If I try to create a File from the String filename, this filename is converted OK to platform specifics; but if I create a ZipEntry from the String filename, it is NOT converted to platform specifics, leading to a filename in ZIP archive which is the Unicode image (unreadable from various ZIP tools !).
For instance:
String filename = "?l?ve.txt";
// This will create a right filename on disk
File myFile = new File(filename);
...
// A file ?l?ve.txt is created on disk
// This will create a bad (unconverted) filename in ZIP archive
ZipEntry myEntry = new Entry(filename);
...
// An entry ??l??ve.txt is created in ZIP archive
The result is that the generated ZIP entry is not usable for extraction...
(Review ID: 83688)
======================================================================
Name: tb29552 Date: 03/24/2000
Solaris VM (build Solaris_JDK_1.2.1_04, native threads, sunwjit)
Classic VM (build JDK-1.2.2-W, green threads, sunwjit)
java version "1.1.6"
Within a ZIP file, pathnames use the forward slash / as separator, as required
by the ZIP
<A HREF="ftp://ftp.uu.net/pub/archiving/zip/doc/appnote-970311-iz.zip">spec</A>.
This requires a conversion from or to the local file.separator on systems like
Windows. The API (ZipEntry) does not take care of the transformation, and the
need for the programmer to deal with it is not documented. As a result, code
like
ZipEntry ze;
File f;
f = new File( ze.getName());
will be written and fail on the Windows platform, or the reverse
ze = new ZipEntry( f.getName());
will fail or produce invalid jars on Windows platforms.
Either the docs or the API needs to be fixed. Preferably a new method and
constructor could be added
File f = ze.toFile(); ze = new ZipEntry( f);
that would perform the translation between '/' and File.separatorChar, leaving
the existing methods/constructors (perhaps deprecated) for use by existing code.
But if the API is not fixed, then the docs must be fixed to make sure the
programmer deals with the translation explicitly.
Note new methods in java.util.zip.ZipEntry would also need to be reflected
in java.util.jar.JarEntry.
(Review ID: 100505)
======================================================================
- csr of
-
CCC-4244499 ZipEntry() does not convert filenames from Unicode to platform
-
- Closed
-
- duplicates
-
JDK-4415733 util.zip does not support umlaut (mutated vowel) in file/path-names in zip file
-
- Closed
-
-
JDK-4508677 Non-asci file names in java.util.zip
-
- Closed
-
- relates to
-
JDK-4532049 IllegalArgumentException in ZipInputStream while reading unicode file
-
- Resolved
-
-
JDK-4980042 Cannot use Surrogates in zip file metadata like filenames
-
- Resolved
-
-
JDK-6272251 jarsigner crashes with NullPointerException on a filename having german umlauts
-
- Closed
-
-
JDK-4412571 Implementation of Jar file does not match specification.
-
- Closed
-
-
JDK-6245146 Classes in java.util.zip have incorrect statement about maximum string length in some methods
-
- Closed
-
-
JDK-4700978 ZipFile can't treat Japanese name in a zipfile properly
-
- Resolved
-
-
JDK-4820807 java.util.zip.ZipInputStream cannot extract files with Chinese chars in name
-
- Resolved
-
-
JDK-5030283 Incorrect implementation of UTF-8 in zip package
-
- Resolved
-
-
JDK-6739892 Improve handling of zip encoding through use of property flag
-
- Closed
-