Create UTF8Encoding class
using System; using System.Text; class UTF8EncodingExample { public static void Main() { UTF8Encoding utf8 = new UTF8Encoding(); UTF8Encoding utf8EmitBOM = new UTF8Encoding(true); ShowArray(utf8.GetPreamble()); ShowArray(utf8EmitBOM.GetPreamble()); } public static void ShowArray(Array theArray) { foreach (Object o in theArray) { Console.Write("[{0}]", o); } Console.WriteLine(); } }