title: How to get a text file's encoding name by analyzing its byte in order to dynamically interpret it according to its Character encoding
body: <pre><code>   public string[] AbrirArquivo(byte[] Arquivo)
          {
              
              var arquivoTxt = new StreamReader(new MemoryStream(Arquivo), Encoding.GetEncoding(&quot;utf-8&quot;)).ReadToEnd();
  
              var linhas = arquivoTxt.Split('\n');
  
              return linhas;
          }
  </code></pre>
  <p>I want to create a variable before the var arquivoTxt and store inside it, the value of  Arquivo's Character encoding. So I will replace the &quot;utf-8&quot; to my new variable, and then through this manner, my work will be completed.
  The issue is, I don't know how to get the value of  Arquivo's Character encoding. Could any body help me out to solve this, please?.</p>
  <p>Because many of the users aren't English speakers, The problem often is because many of them upload ANSI encoded files, then the special Characters get broken, and it sucks. I really need to find out a way to figure this out.</p>