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

java.util.zip.ZipException when filename contains Japanese characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • core-libs

      Customer Problem Description:
      -------------------------------

      >This is a problem with the ZIP's filename contains Japanese characters,
      >not necessarily when the files in the ZIP contain them.
      >
      >When dealing with files with Japanese characters, the locale will normally
      >be set to Japanese as well. However, it should still be able to read the
      >files no matter what the locale is. For example, Windows Explorer deals
      >with them correctly, as does the JDK except when trying to open them as
      >ZIPs. For other internationalization testing, I didn't have to change my
      >locale to get the VM to process the characters correctly.
      >
      > >I've got another JDK bug to push to Sun. This happens on 1.4.1_03, Win2K.
      > >I couldn't find any other reports on java.sun.com or elsewhere online. I
      > >also repro'd on 1.4.1 and 1.4.1_02, and on WinXP. These were both English
      > >installs of the OS, haven't tried on other versions.
      > >
      > >The problem is that the constructor to java.util.zip.ZipFile throws a
      > >ZipException if the path to the file contains Japanese characters.
      > >
      > >Repro steps:
      > >
      > >Edit ZipRepro.java so that it points to a valid directory on the local
      > >machine.
      > >Compile ZipRepro.java.
      > >Copy any valid ZIP file to the directory your source is pointing to.
      > >Rename the ZIP file so that its name contains Japanese characters. (Go to
      > >www.beasys.co.jp and copy some text, then paste into Windows Explorer
      > >doing a rename).
      > >Run ZipRepro, output is:
      > >
      > >Exception in thread "main" java.util.zip.ZipException: The filename,
      > >directory name, or volume label syntax is incorrect
      > > at java.util.zip.ZipFile.open(Native Method)
      > > at java.util.zip.ZipFile.<init>(ZipFile.java:112)
      > > at java.util.zip.ZipFile.<init>(ZipFile.java:72)
      > > at ZipRepro.main(ZipRepro.java:14)
      > >
      > >No known workarounds besides copying the ZIP to a different filename.
      > >

      > >
      > >Followup:
      > >
      > >I don't get the exception if I set my machine to use the Japanese locale.
      > >Best guess is that the native ZIP libraries are using the platform's
      > >default encoding when working with the filename.

            sherman Xueming Shen
            cprasadsunw Ck Prasad (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: