ASP.NET Core 2.1 Error - 'Cyrillic' is not a supported encoding name
After upgrading to ASP.NET Core 2.1 (.NET Core SDK 2.1.301), you may encounter the following error about encoding:
System.ArgumentException
HResult=0x80070057
Message='Cyrillic' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
Source=System.Private.CoreLib
StackTrace:
at System.Text.EncodingTable.internalGetCodePageFromName(String name)
at System.Text.EncodingTable.GetCodePageFromName(String name)
at System.Text.Encoding.GetEncoding(String name)
The error message itself already provides the solution.
To resolve the issue, add package reference System.Text.Encoding.CodePages.
And then register code page encoding provider via Encoding.RegisterProvider method.
public void ConfigureServices(IServiceCollection services) {
// …
// Register code Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}
info Last modified by Administrator 4 years ago
copyright
This page is subject to Site terms.
comment Comments
No comments yet.
Log in with external accounts
warning Please login first to view stats information.
article
.NET for Apache Spark Preview with Examples
article
EntityFramework Core - Connect to MySQL
article
Retrieve Http client request metadata like IP address and languages in asp.net core
article
Logging configuration in .NET core
article
Fix Error CryptographicException: The payload was invalid.
Read more (38)