Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4508677

Non-asci file names in java.util.zip

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.1
    • core-libs
    • generic
    • generic



      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
      ()).getName());
        }

      }

      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)
      ======================================================================

            kkladkosunw Konstantin Kladko (Inactive)
            bstrathesunw Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: