JDK-4508677 : Non-asci file names in java.util.zip
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 1.3.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-09-28
  • Updated: 2002-05-10
  • Resolved: 2002-05-10
Related Reports
Duplicate :  

Name: bsT130419			Date: 09/28/2001

java version "1.3.1-rc2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-rc2-b23)
Java HotSpot(TM) Client VM (build 1.3.1-rc2-b23, mixed mode)

1. ZipFile zip = new ZipFile();
   zip.getEntry(...);  ..(2)
   in section 2, may error occurs in non-unicode bytes.

2. for show the errors, create one "Traditional-Chinese" Locale bytes file
   to compress with zip format, then use ZipFile to read ZipEntry.

(CP950 for below encoding)
一       TXT             0  09-29-01   0:52 一.txt
1        ZIP           230  09-29-01   0:55 1.zip

the "TXT" file contains two-byte characters, use WinZip to compress to 1.zip,
but WinZip not uses Unicode to compress it! Use 0-255 to describe ZipEntry.

the error occurs ZipFile to process the 1.zip :(

import java.util.*;
import java.util.zip.*;
import java.io.*;

public class test {

  public static void main(String[] argv) throws Exception
     ZipFile zip = new ZipFile("1.zip");
     Enumeration zEnum = zip.entries();
     while( zEnum.hasMoreElements() )
       System.out.println("Zip Name: " + ( (ZipEntry) zEnum.nextElement


C:\store>java test
Zip Name: ?@.txt

Right, this isn't current result! Just because the chinese word contains
below two bits: (>127)(0-127), so, process this kind of java.util.Zip packages
will always bug(or WinZip not support Unicode).

4. use jar.exe and WinZip to compress ASCII code work excellent!
   But, use jar.exe to compress/extract zipfile will use unicode, but WinZip
   don't :(

5. WinZip 6.3 or Later with jar.exe will occur problem with "CJK" Locale.
(Review ID: 132815) 

WORK AROUND Name: bsT130419 Date: 09/28/2001 patch java.lang.String class, add one method called: setUnicoded(boolean); as this method called, won't convert to unicode, and System.out need re-write. ======================================================================

EVALUATION One should be able to use non-ASCI file names with java.util.zip - we have many requests related to that. This feature will considered for feature releases. ###@###.### 2002-04-16