using System.Collections.Generic;
public static void Main()
foreach (char c in GetAllWritableCharacters(Encoding.UTF8))
Console.WriteLine($"[{c}] {(IsPrintableCharacter(c) ? "" : "** invalid **")}");
private static bool IsPrintableCharacter(char c)
private static IEnumerable<char> GetAllWritableCharacters(Encoding encoding)
encoding = Encoding.GetEncoding(encoding.WebName, new EncoderExceptionFallback(), new DecoderExceptionFallback());
char[] chars = new char[1];
byte[] bytes = new byte[16];
for (int i = char.MinValue; i <= char.MaxValue; i++)
int count = encoding.GetBytes(chars, 0, 1, bytes, 0);
yield return returnChar.Value;