Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'IBM437' is not a supported encoding name from ZipFile Read Method

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.

like image 400
Merlí Escarpenter Pérez Avatar asked Sep 23 '14 10:09

Merlí Escarpenter Pérez


1 Answers

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.

like image 70
Caleb Rotich Avatar answered Sep 20 '22 22:09

Caleb Rotich