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

荒凉一梦 提交于 2019-12-06 22:29:41

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/25993251/ibm437-is-not-a-supported-encoding-name-from-zipfile-read-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!