title: Why is the XmlWriter always outputting utf-16 encoding?
body: <p>I have this extension method</p>
  
  <pre><code>    public static string SerializeObject&lt;T&gt;(this T value)
      {
          var serializer = new XmlSerializer(typeof(T));           
          var settings = new XmlWriterSettings
                         {
                          Encoding = new UTF8Encoding(true), 
                          Indent = false, 
                          OmitXmlDeclaration = false,
                          NewLineHandling = NewLineHandling.None
                         };
  
          using(var stringWriter = new StringWriter()) 
          {
              using(var xmlWriter = XmlWriter.Create(stringWriter, settings)) 
              {
                  serializer.Serialize(xmlWriter, value);
              }
  
              return stringWriter.ToString();
          }
      }
  </code></pre>
  
  <p>but whenever I call this it has an encoding of <code>utf-16</code> specified, ie <code>&lt;?xml version="1.0" encoding="utf-16"?&gt;</code>.  What am I doing wrong?</p>