The usual anwer that I see around here would be to first set the DefaultCodePage, e.g.
ZipConstants.DefaultCodePage = 850;
That should work for you.
However, I have an alternative that I hope people reading this will give their opinion on:
ZipConstants.VERSION_MADE_BY = 0x0B14;
This sets the OS to Windows NTFS (at least, according to the specs from
www.info-zip.org, which differ from the pkware specs). I got this wisdom from looking at files created by WinZip:
- a filename with only OEM chars in it is written with 'version = 0x0014' and is OEM encoded
- a filename with chars that are in Windows-1252 but not in OEM, is written with
'version = 0x0B14' and is Windows-1252 encoded
- a filename with Unicode chars that are not in Windows-1252 is not accepted
In other words: tools like WinZip will assume the file names are OEM
encoded, unless you set the HostSystem to 0x0B, then it assumes the
encoding is default, that is, DefaultCodePage 0.
(On the down side, Window XP zip support does not seem to understand the HostSystem byte.)
Anyway, this seems like a good idea if you do not know in advance what filenames you will get.
Right?
Casper