tags:

views:

153

answers:

1

I am using DotNetZip. When i am archiving file which have english name all normally. but when i archiving file with russian names in result archive with bad names of file. Some peoplese said that string

ZipConstants.DefaultCodePage = 866;

But it not compile. I also use zip.UseUnicodeAsNecessary properties, and convert my file names to utf8 and utf7.

+1  A: 

To create a unicode zip file in DotNetZip:

using (var zip = new ZipFile())
{
   zip.UseUnicodeAsNecessary= true;
   zip.AddFile(filename, "directory\\in\\archive");
   zip.Save("archive.zip");
}

If you want a particular, specific code page, then you must use something else:

using (var zip = new ZipFile())
{
   zip.ProvisionalAlternateEncoding = System.Text.Encoding.GetEncoding(866);
   zip.AddFile(filename, "directory\\in\\archive");
   zip.Save("archive.zip");
}

Check the documentation for those properties before using them!

Cheeso