title: c# - create and save an xml as UTF-8 (without BOM)
body: <p>I need to save an xml file in UTF-8 encoding but when i check in notepad++ the encoding is UTF-8 BOM. how do i forcefully make the encoding UTF-8. My code is below:</p>
  
  <pre><code>XmlWriterSettings settings = new XmlWriterSettings();
  settings.Encoding = Encoding.UTF8;
  XmlWriter writer = XmlWriter.Create(tempPath, settings);
  xdoc.Save(writer);
  </code></pre>