JDK-4885817 : java.util.zip.ZipException when filename contains Japanese characters
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-07-01
  • Updated: 2009-06-03
  • Resolved: 2009-06-03
Related Reports
Duplicate :  
Relates :  
Description
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.

Comments
EVALUATION With the fix for #6374379 zip open has switched to use io_util_md.c/winFileHandleOpen, which handle file name in Unicode when "talk to" Windows API, so zip file should be open correctly, even with filename contains Japanese and NOT in a Japanese locale. Verified with 6u10.
03-06-2009

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
02-09-2004

EVALUATION Windows historically used different encodings on different versions of the operating system. Recently, a new pure-Unicode version of the Windows API has been introduced. Sun is in the process of converting to using that new API consistently on Windows, but that transition has not yet been completed, and it is far too risky for Tiger. This problem will be easier to fix when the JDK no longer has to support Windows 98 and friends, which have inferior Unicode support. So this will likely get fixed in 1.6. ###@###.### 2003-11-04
04-11-2003