Created
February 27, 2015 13:55
-
-
Save jstedfast/a819e0cce183d7055204 to your computer and use it in GitHub Desktop.
Lists available charset encodings for .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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