title: Reading an XML File in .NET Core 3.1 with UTF-8 vs UTF-16
body: <p>I get the following error (which I see on other SO posts):</p>
  <pre><code>There is no Unicode byte order mark. Cannot switch to Unicode.
  </code></pre>
  <p>I see on other SO posts that users swith:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;
  </code></pre>
  <p>to:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  </code></pre>
  <p>I cannot update all my importing XMLs on the fly to switch this so I want to know how to do it programmatically. I have the following code where the</p>
  <pre><code>    private static string ParseXML(Stream xmlSteam)
      {
          using (var xmlReader = XmlReader.Create(xmlSteam))
          {
              // Errors out here with the unicode exception being caught
              while (xmlReader.Read())
  </code></pre>
  <p>I am trying to fix it so it will read and parse the XML.</p>