title: Windows-1252 is not a supported encoding name C# deserialization
body: <blockquote>
    <p>ArgumentException: 'Windows-1252' is not a supported encoding
    name...</p>
  </blockquote>
  
  <p>That's the message when I try to deserialize my XML file. 
  The first line of the XML is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="Windows-1252"?&gt;
  </code></pre>
  
  <p>That's the code:</p>
  
  <pre><code>    using System;
      using System.IO;
      using System.Xml;
      using System.Xml.Serialization;
      using System.Collections.Generic;
  
  
      namespace EdocX_Test_Using
      {
          class Program
          {
              static void Main(string[] args)
              {
                  Program test = new Program();
  
                  foreach (var file in Directory.GetFiles(@"N:\EGS_SDRE\OB\19_Schnittstellen_eDocX_ITAS\06_Matching EdocX-Objektbrief\01_exemplarische_XMLs_fuer_den_Import\RWA-Anlage", "*.xml"))
                  {
                      Console.WriteLine("\n----------------------------------------\nFILENAME: " + file + "\n----------------------------------------" + "\r\n");
                      if (!File.Exists(file)) { Console.WriteLine("Datei existiert nicht"); }
  
                      test.deserializeobject(file);              
                      //break; // Breaks after first for now
                  }
  
                  Console.ReadKey();
              }
  
              private void deserializeobject(string filename)
              {
                  // new instance of XMLSerializer --&gt; specifiying type
                  var serializer = new XmlSerializer(typeof(Document));
  
                  // read the XML document with a FileStream
                  using (var fs = new FileStream(filename, FileMode.Open))
                  using (var reader = XmlReader.Create(fs))
                  {
                      // restore the object's state using the deserialize method
                      var i = (Document)serializer.Deserialize(reader);
                  }
               }
           }
        }
  </code></pre>