Index: ebcdic.h =================================================================== --- ebcdic.h.orig 2005-01-29 05:25:54.000000000 +0100 +++ ebcdic.h 2009-11-24 18:19:52.726932000 +0100 @@ -254,6 +254,25 @@ ZCONST uch Far iso2oem[] = { 0xD0, 0xA4, 0x95, 0xA2, 0x93, 0xE4, 0x94, 0xF6, /* F0 - F7 */ 0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98 /* F8 - FF */ }; + +ZCONST uch Far iso2oem_2[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, + 0x20, 0xA4, 0xF4, 0x9D, 0xCF, 0x95, 0x97, 0xF5, + 0xF9, 0xE6, 0xB8, 0x9B, 0x8D, 0x2D, 0xA6, 0xBD, + 0x20, 0xA5, 0xF2, 0x88, 0xEF, 0x96, 0x98, 0xF3, + 0xF7, 0xE7, 0xAD, 0x9C, 0xAB, 0xF1, 0xA7, 0xBE, + 0xE8, 0xB5, 0xB6, 0xC6, 0x8E, 0x91, 0x8F, 0x80, + 0xAC, 0x90, 0xA8, 0xD3, 0xB7, 0xD6, 0xD7, 0xD2, + 0xD1, 0xE3, 0xD5, 0xE0, 0xE2, 0x8A, 0x99, 0x9E, + 0xFC, 0xDE, 0xE9, 0xEB, 0x9A, 0xED, 0xDD, 0xE1, + 0xEA, 0xA0, 0x83, 0xC7, 0x84, 0x92, 0x86, 0x87, + 0x9F, 0x82, 0xA9, 0x89, 0xD8, 0xA1, 0x8C, 0xD4, + 0xD0, 0xE4, 0xE5, 0xA2, 0x93, 0x8B, 0x94, 0xF6, + 0xFD, 0x85, 0xA3, 0xFB, 0x81, 0xEC, 0xEE, 0xFA +}; #endif /* IZ_ISO2OEM_ARRAY */ #ifdef IZ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) Index: globals.c =================================================================== --- globals.c.orig 2005-03-20 21:32:02.000000000 +0100 +++ globals.c 2009-11-24 18:19:52.730930000 +0100 @@ -30,6 +30,8 @@ int pathput = 1; /* 1=store path int scanimage = 1; /* 1=scan through image files */ #endif int method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */ +int winify = 0; /* 1=file names will be converted from IBM PC CP 850 to ISO8859-1 */ +int iso8859_2 = 0; /* 1=ISO8859-2 will be used instead of ISO8859-1 */ int dosify = 0; /* 1=make new entries look like MSDOS */ int verbose = 0; /* 1=report oddities in zip file structure */ int fix = 0; /* 1=fix the zip file */ Index: man/zip.1 =================================================================== --- man/zip.1.orig 2006-06-20 04:25:00.000000000 +0200 +++ man/zip.1 2009-11-24 18:19:52.747932000 +0100 @@ -14,7 +14,7 @@ zip, zipcloak, zipnote, zipsplit \- package and compress (archive) files .SH SYNOPSIS .B zip -.RB [ \-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$ ] +.RB [ \-aABcdDeEfFghjkKlLmoOqrRSTuvVwXyz!@$ ] .RB [ \-b\ path ] .RB [ \-n\ suffixes ] .RB [ \-t\ mmddyyyy ] @@ -543,7 +543,15 @@ Attempt to convert the names and paths t store only the MSDOS attribute (just the user write attribute from UNIX), and mark the entry as made under MSDOS (even though it was not); for compatibility with PKUNZIP under MSDOS which cannot handle certain -names such as those with two dots. +names such as those with two dots. Conversion from ISO8859-1 to +IBM PC CP 852 is used. See also +.B \-O +.TP +.B \-K +Attempt to convert the names and paths to conform to MS Windows. Behaviour +similar to +.B \-k +but long names are used. .TP .B \-l Translate the Unix end-of-line character LF into the @@ -706,6 +714,11 @@ will change the last modified time of to the latest time of the entries in .IR foo.zip . .TP +.B \-O +File names will be converted from ISO8859-2 instead of from ISO8859-1. See +.B \-k +for details. +.TP \fB\-P\fP\ \fIpassword\fP use \fIpassword\fP to encrypt zipfile entries (if any). \fBTHIS IS INSECURE!\fP Many multi-user operating systems provide ways for any user to Index: unix/unix.c =================================================================== --- unix/unix.c.orig 2006-05-30 00:35:00.000000000 +0200 +++ unix/unix.c 2009-11-24 18:19:52.754931000 +0100 @@ -261,9 +261,14 @@ int *pdosflag; /* output: force return NULL; strcpy(n, t); - if (dosify) + if ((dosify) && (!winify)) msname(n); +#ifdef IZ_ISO2OEM_ARRAY + if (dosify) + str_iso_to_oem(n, n); +#endif + #ifdef EBCDIC strtoasc(n, n); /* here because msname() needs native coding */ #endif Index: util.c =================================================================== --- util.c.orig 2006-03-06 07:13:30.000000000 +0100 +++ util.c 2009-11-24 18:19:52.759937000 +0100 @@ -470,7 +470,10 @@ char *str_iso_to_oem(dst, src) char *dst; { char *dest_start = dst; - while (*dst++ = (char)iso2oem[(uch)(*src++)]); + if (!iso8859_2) + while (*src) { *dst++ = (*src & 0x80) ? iso2oem[*src++ & 0x7f] : *src++; } + else + while (*src) { *dst++ = (*src & 0x80) ? iso2oem_2[*src++ & 0x7f] : *src++; } return dest_start; } #endif @@ -481,7 +484,10 @@ char *str_oem_to_iso(dst, src) char *dst; { char *dest_start = dst; - while (*dst++ = (char)oem2iso[(uch)(*src++)]); + if (!iso8859_2) + while (*src) { *dst++ = (*src & 0x80) ? oem2iso[*src++ & 0x7f] : *src++; } + else + while (*src) { *dst++ = (*src & 0x80) ? oem2iso_2[*src++ & 0x7f] : *src++; } return dest_start; } #endif Index: zip.c =================================================================== --- zip.c.orig 2006-06-19 02:16:24.000000000 +0200 +++ zip.c 2009-11-24 18:19:52.766924000 +0100 @@ -979,6 +979,8 @@ char **argv; /* command line dispose = 0; /* 1=remove files after put in zip file */ pathput = 1; /* 1=store path with name */ method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */ + winify = 0; /* 1=file names will be converted from IBM PC CP 850 to ISO8859-1 */ + iso8859_2 = 0; /* 1=ISO8859-2 will be used instead of ISO8859-1 */ dosify = 0; /* 1=make new entries look like MSDOS */ verbose = 0; /* 1=report oddities in zip file structure */ fix = 0; /* 1=fix the zip file */ @@ -1263,6 +1265,8 @@ char **argv; /* command line junk_sfx = 1; break; case 'k': /* Make entries using DOS names (k for Katz) */ dosify = 1; break; + case 'K': /* file names will be converted from IBM PC CP 850 to ISO8859-1 */ + winify = dosify = 1; break; case 'l': /* Translate end-of-line */ translate_eol++; break; #ifndef WINDLL @@ -1287,6 +1291,8 @@ char **argv; /* command line #endif case 'o': /* Set zip file time to time of latest file in it */ latest = 1; break; + case 'O': /* ISO8859-2 will be used instead of ISO8859-1 */ + iso8859_2 = 1; break; case 'p': /* Store path with name */ break; /* (do nothing as annoyance avoidance) */ case 'P': /* password for encryption */ Index: zip.h =================================================================== --- zip.h.orig 2005-06-16 05:55:28.000000000 +0200 +++ zip.h 2009-11-24 18:19:52.770930000 +0100 @@ -245,9 +245,11 @@ extern ZCONST uch ebcdic[256]; #endif /* EBCDIC */ #ifdef IZ_ISO2OEM_ARRAY /* ISO 8859-1 (Win CP 1252) --> OEM CP 850 */ extern ZCONST uch Far iso2oem[128]; +extern ZCONST uch Far iso2oem_2[128]; #endif #ifdef IZ_OEM2ISO_ARRAY /* OEM CP 850 --> ISO 8859-1 (Win CP 1252) */ extern ZCONST uch Far oem2iso[128]; +extern ZCONST uch Far oem2iso_2[128]; #endif extern char errbuf[FNMAX+81]; /* Handy place to build error messages */ extern int recurse; /* Recurse into directories encountered */ @@ -263,6 +265,8 @@ extern int scanimage; /* Scan #define DEFLATE 8 /* Deflation method*/ extern int method; /* Restriction on compression method */ +extern int winify; /* file names will be converted from IBM PC CP 850 to ISO8859-1 */ +extern int iso8859_2; /* ISO8859-2 will be used instead of ISO8859-1 */ extern int dosify; /* Make new entries look like MSDOS */ extern char *special; /* Don't compress special suffixes */ extern int verbose; /* Report oddities in zip file structure */ Index: unix/Makefile =================================================================== --- unix/Makefile.orig 2006-04-23 01:52:18.000000000 +0200 +++ unix/Makefile 2009-11-24 18:19:52.774937000 +0100 @@ -46,7 +46,7 @@ VERSION = Version 2.32 # CFLAGS flags for C compile # LFLAGS1 flags after output file spec, before obj file list # LFLAGS2 flags after obj file list (libraries, etc) -CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP) +CFLAGS_NOOPT = -I. -DUNIX -DIZ_ISO2OEM_ARRAY $(LOCAL_ZIP) CFLAGS = -O2 $(CFLAGS_NOOPT) LFLAGS1 = LFLAGS2 = -s