Skip to content

Instantly share code, notes, and snippets.

@jstedfast
Created February 27, 2015 13:55
Show Gist options
  • Save jstedfast/a819e0cce183d7055204 to your computer and use it in GitHub Desktop.
Save jstedfast/a819e0cce183d7055204 to your computer and use it in GitHub Desktop.
Lists available charset encodings for .NET
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Charsets
{
class Program
{
static void Main (string[] args)
{
using (var fs = new StreamWriter (File.OpenWrite ("charsets.txt"))) {
foreach (var info in Encoding.GetEncodings ()) {
var encoding = info.GetEncoding ();
fs.WriteLine ("Name = {0}, CodePage = {1}, HeaderName = {2}, BodyName = {3}", info.Name, info.CodePage, encoding.HeaderName, encoding.BodyName);
}
fs.WriteLine ("Default system charset: {0}", Encoding.Default.HeaderName);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment