21

I have a problem when my code execute this using:

using (ZipFile archive = ZipFile.Read(File))    //<== Crash Here!
{
    foreach (ZipEntry entry in archive.Entries)
    {
        entry.Extract(UnZipFolder.Name.ToString(), ExtractExistingFileAction.OverwriteSilently);   
    }
}

Crash when ZipFile try to read my File that it's a string and contains, sincrofit.zip then crash and throw this exception:

'System.ArgumentException' Additional information: 'IBM437' is not a supported encoding name.

wonea
  • 4,783
  • 17
  • 86
  • 139

1 Answers1

48

In Visual Studio:

  1. Open Package Manager Console and type in Install-Package System.Text.Encoding.CodePages -Version 4.4.0. Change the version number appropriately.

  2. Add this line to your code: Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

  3. Attach the necessary directive if required.

Caleb Rotich
  • 603
  • 5
  • 11