C
C#2y ago
morry329#

✅ System.ArgumentException 'IBM437' is not a supported encoding name.

I wanted to compress my epub file via .Net with this tutorial https://products.aspose.com/zip/net/compress/epub/ I just copied and pasted its source code into my Rider and ran it. Then it gave me this error
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')
at System.Text.EncodingTable.InternalGetCodePageFromName(String name)
at System.Text.EncodingTable.GetCodePageFromName(String name)
at System.Text.Encoding.GetEncoding(String name)
at Aspose.Zip.Archive.Save(Stream outputStream, ArchiveSaveOptions saveOptions)
at Aspose.Zip.Archive.Save(String destinationFileName, ArchiveSaveOptions saveOptions)
at Program.<Main>$(String[] args) in /Users/musterfrau/RiderProjects/CompressViaRider/CompressViaRider/Program.cs:line 12
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')
at System.Text.EncodingTable.InternalGetCodePageFromName(String name)
at System.Text.EncodingTable.GetCodePageFromName(String name)
at System.Text.Encoding.GetEncoding(String name)
at Aspose.Zip.Archive.Save(Stream outputStream, ArchiveSaveOptions saveOptions)
at Aspose.Zip.Archive.Save(String destinationFileName, ArchiveSaveOptions saveOptions)
at Program.<Main>$(String[] args) in /Users/musterfrau/RiderProjects/CompressViaRider/CompressViaRider/Program.cs:line 12
` The line the error points to is
arch.Save(dir+"archived_result.zip");
arch.Save(dir+"archived_result.zip");
` But I only copied and pasted from the aspose website. I tried this SO post https://stackoverflow.com/questions/25993251/ibm437-is-not-a-supported-encoding-name-from-zipfile-read-method But the IBM437 error still appears. Does anyone know any workaround here?
Compress EPUB Files via .NET
C# compression source code to compress EPUB documents into a single zip archive or vice versa on .NET Framework, .NET Core.
Stack Overflow
'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(
2 Replies
reflectronic
reflectronic2y ago
are you sure you did the SO post right, because that is the way you fix this problem you need to add the latest version of System.Text.Encoding.CodePages on NuGet, and then call Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); before you call Save
morry329#
morry329#2y ago
Ahh ok no, I did not add the latest version of System.Text.Encoding.Codepages I will try with the latest version again Thank you so much for your response 🙂 I just found out that not calling
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
before I call Save was the major culprit for the error 🙂 It works perfectly now