zipstorer
zipstorer copied to clipboard
Error encoding 437 .net core 3.1
Raise this error No data is available for encoding 437. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
as workaround i comment the lines private static Encoding DefaultEncoding = Encoding.UTF8/* Encoding.GetEncoding(437)*/;
I got this same error in a .NET6 project:
NotSupportedException: No data is available for encoding 437. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
The solution is documented in this SO Post.
To fix this in the library, the .NETStandard project needs to include NuGet Package System.Text.Encoding.CodePages
And then the constructor of ZipStorer
needs to include the initialization:
CodePagesEncodingProvider.Instance.GetEncoding(437);
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
As a workaround, you can do this to your own project but it would be nice if the library handled it so we don't all need to find this workaround one by one.