2

I have archive with cyrillic filenames created at Win10

        var path = "D:\\encoding.zip";
        using (var tempZip = new ZipOutputStream(System.IO.File.Create(path)))
        {
            for (int i = 0; i < 10; i++)
            {
                var entry = new ZipEntry($"Привет {i + 1}.txt")
                {
                    IsUnicodeText = true
                };
                tempZip.PutNextEntry(entry);
            }
        }

At win10 I have right encoded names but when I open this archive at Win7 I get incorrect encoding.

I tried to set ZipConstants.DefaultCodePage = 866; but I got same error. I migrated this code from DotNetZip and with DotnetZip I have this error too, but I fixed it using:

tempZip.AlternateEncoding = Encoding.GetEncoding(866);
tempZip.AlternateEncodingUsage = ZipOption.AsNecessary;

I haven't found this option in SharpZLib. So how can I fix this this error?

takayoshi
  • 2,789
  • 5
  • 36
  • 56

0 Answers0