0

I am a newbie to C# and want to zip a file with password. After googling I found about DotNetZip and tried the following but it doesnt work. What other options can I try to zip with password in c#?

using Ionic.Zip;

namespace CSLab
{
  class Program
  {
     static void Main(string[] args)
     {
       using (ZipFile zip = new ZipFile())
       {
         zip.Password = "password";
         zip.AddDirectory("./test");
         zip.Save("a.zip");
       }
     }
   }
 }


 Unhandled Exception: System.ArgumentException: 'IBM437' is not a 
 supported encoding name. For information on defining a custom 
 encoding, see the documentation for the Encoding.RegisterProvider method.
 Parameter name: name
 at System.Globalization.EncodingTable.GetCodePageFromName(String name)
 at System.Text.Encoding.GetEncoding(String name)
 at Ionic.Zip.ZipFile..ctor()
 at CSLab.Program.Main(String[] args) in 
 bash: line 1: 17217 Abort trap: 6           
 "/usr/local/share/dotnet/dotnet" 
 "/usr../bin/Debug/netcoreapp2.0/CSLab.dll"
user2399453
  • 2,930
  • 5
  • 33
  • 60
  • Don't re-ask your question. My comment on your previous question explains what you need to do. You need to use a different encoding on a mac. –  Jan 22 '18 at 21:21
  • I tried everything suggested in that answer and the same error happens. Some of the options were also flagged as deprecated. – user2399453 Jan 22 '18 at 21:23
  • I tried zip.AlternateEncodingUsage = ZipOption.Always; from the link you posted, is there anything else I could try? – user2399453 Jan 22 '18 at 21:30

0 Answers0