title: read special characters in c# from a file
body: <p>I have a text file which contains one of the following strings.</p>
  
  <pre><code> Match List – I and List – II and identify the correct code :
  </code></pre>
  
  <p>I have the following code in C# to read this line and when i console.write it I get </p>
  
  <pre><code>  Match List ? I and List ? II and identify the correct code :
  </code></pre>
  
  <p>on close scrutiny i got to understand :</p>
  
  <pre><code> – and - are different!
  </code></pre>
  
  <p>now how can I read the file and get it exactly? I need the data to be stored in a database.</p>
  
  <p>my code:</p>
  
  <pre><code>       string filefullnamepath = @"E:\PROJECTS\NETSLET\Console\Console\files\sample.txt";
          string filecontents = "";
          using (StreamReader sr = System.IO.File.OpenText(filefullnamepath))
          {
              filecontents = sr.ReadToEnd();
          }
  </code></pre>
  
  <p>Ok I added the following line:   </p>
  
  <pre><code> Console.OutputEncoding = System.Text.Encoding.UTF8;
  </code></pre>
  
  <p>now i get <a href="https://i.stack.imgur.com/lURwF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lURwF.png" alt="enter image description here"></a></p>
  
  <p>I need to store the contents in the database. Even in the database it is stored as ? I am using ms-sql server 2018r2</p>