Skip to content

Instantly share code, notes, and snippets.

@SeppPenner
Last active January 11, 2019 08:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SeppPenner/ae65fccdd81bce23cd8818ffe22589c1 to your computer and use it in GitHub Desktop.
Save SeppPenner/ae65fccdd81bce23cd8818ffe22589c1 to your computer and use it in GitHub Desktop.
Using CodePages in C# (e.g. .netCore/ NetCore) to provide special Windows encodings (e.g. 1252)
  1. Add the nuget package System.Text.Encoding.CodePages to your project
  2. Use it like this example:
public class Test
{
	public Test()
	{
		Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
	}
	
	public void Example()
	{
		var encoding = Encoding.GetEncoding(1252);
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment