Provides support for code-page based encodings, including Windows-1252, Shift-JIS, and GB2312. Commonly Used Types: System.Text.CodePagesEncodingProvider
$ dotnet add package System.Text.Encoding.CodePagesSystem.Text.Encoding.CodePages enable creating single and double bytes encodings for code pages that otherwise are available only in the desktop .NET Framework.
using System.Text;
// Register the CodePages encoding provider at application startup to enable using single and double byte encodings.
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
// Now can create single and double byte encodings for code pages that are not available in .NET Core.
Encoding windows1252Encoding = Encoding.GetEncoding(1252); // Western European (Windows)
byte[] encodedBytes = windows1252Encoding.GetBytes("String to encode");
The main types provided by this library are:
CodePagesEncodingProviderSystem.Text.Encoding.CodePages is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.