archive-zip: support UTF-8 paths
commit2162bd8cc461d6c3a12ab81c5db5a44bf5ecabc3
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Tue, 4 Sep 2012 20:23:38 +0000 (4 22:23 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 4 Sep 2012 21:06:18 +0000 (4 14:06 -0700)
treed34f1c81ff5dcb84fb7ed5e64610ffb2df5bb029
parentb52183179bb0a97ea4d91d1248aca303d8e8f892
archive-zip: support UTF-8 paths

Set general purpose flag 11 if we encounter a path that contains
non-ASCII characters.  We assume that all paths are given as UTF-8; no
conversion is done.

The flag seems to be ignored by unzip unless we also mark the archive
entry as coming from a Unix system.  This is done by setting the field
creator_version ("version made by" in the standard[1]) to 0x03NN.

The NN part represents the version of the standard supported by us, and
this patch sets it to 3f (for version 6.3) for Unix paths.  We keep
creator_version set to 0 (FAT filesystem, standard version 0) in the
non-special cases, as before.

But when we declare a file to have a Unix path, then we have to set the
file mode as well, or unzip will extract the files with the permission
set 0000, i.e. inaccessible by all.

[1] http://www.pkware.com/documents/casestudies/APPNOTE.TXT

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
archive-zip.c