title: UTF8 Beginning of File characters are breaking serializer & readers
body: <p>Okay, I'm trying to work with UTF8 text files. I'm constantly fighting the BOM chars that the writer drops in for UTF8, which blows up pretty much anything I need to use to read the file including serializers and other text readers.</p>
  <p>I'm getting a leading six bytes of data:</p>
  <pre><code>0xEF
  0xBB
  0xBF
  0xEF
  0xBB
  0xBF
  </code></pre>
  <p>(now that I'm looking at it, I realize there's two characters there.  Is that the UTF8 BOM marker? Am I double encoding it)?</p>
  <p>Notice the serializer encodes to UTF8, then the memory stream gets a string as UTF8, then I write the string to the file with UTF8... seems like a lot of redundancy.  Thoughts?</p>
  <pre><code>//I'm storing this xml result to a database field. (this one includes the BOF chars)
  using (MemoryStream ms = new MemoryStream())
  {
      Utility.SerializeXml(ms, root);
      xml = Encoding.UTF8.GetString(ms.ToArray());
  
  }
  
  
  //later on, I would take that xml and then write it out to a file like this: 
  File.WriteAllText(path, xml, Encoding.UTF8);
  
  
  
  public static void SerializeXml(Stream output, object data)
  {
      XmlSerializer xs = new XmlSerializer(data.GetType());
      XmlWriterSettings settings = new XmlWriterSettings();
      settings.Indent = true;
      settings.IndentChars = &quot;\t&quot;;
      settings.Encoding = Encoding.UTF8;
      XmlWriter writer = XmlTextWriter.Create(output, settings);
      xs.Serialize(writer, data);
      writer.Flush();
      writer.Close();
  }
  </code></pre>