I have found the following bug in Android.  Where do I report it?

There is a bug in java.util.zip (likely in the ZipEntry class) where
the name of the ZipEntry is not properly encoded in the ZIP file.
This bug affects any UTF-8 characters that are not in the ASCII
range.  An example character is the '©' character, which is Unicode
codepoint 0x00A9 or in UTF-8 is 0xC2 0xA9.

The effect of this bug is that file names that contain non-ASCII are
read back with corrupt file names by other ZIP file reading programs
(ex: PKWare's PKZip or WinRar).  Thus, file names that contain
international characters or special symbols are being corrupted.

What is happening is as follows:
1.  By default, ZIP files contain file names that use the IBM 437
character set for historical reasons.  To use the modern UTF-8
encoding of the Unicode character set, a flag needs to be set in the
zip file.  This flag has been supported since ZIP file format version
6.3.2 which was released in September 2007.
2.  Android writes file names in UTF-8 format but does NOT set this
flag.
3.  What appears to be happening is that the flag field is a 16-bit
field that is stored in little-endian format.  The flag to be set for
UTF-8 support is bit 11.  Instead, bit 3 is being set.  Bit 3 is
documented by PKWare to mean "...fields crc-32, compressed size and
uncompressed size are set to zero...".  However, since the crc-32 and
size fields are not 0, I am guessing that the Android code is _trying_
to set bit 11 but is doing it in incorrect big-endian format and thus
accidentally setting bit 3.

For debugging / testing purposes, I used a hex editor to properly set
bit 11 in the zip file.  This enables other ZIP file reader programs
to properly decode the file names.  I have 2 example ZIP files, before
and after this hex edit, that demonstrate this bug that I can make
available.

Note: do not rely on Microsoft Windows 7 built-in zip reader program
for testing purposes to properly decode the file names since
Microsoft's implementation is known to have several zip-related bugs.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to