title: C# UTF8 Reading/Outputting
body: <p>I'm trying to do something that I think should be fairly simple but I've spent way too much time on it already and I've tried several different approaches that I researched but to no avail.</p>
  
  <p>Basically, I have a huge list of names that have "special" characters in them from the UTF8 charset.</p>
  
  <p>My end goal is to read in each name, and then make an HTTP request using that name in the URL as a GET variable.</p>
  
  <p>My first goal was to read in one name from a file, and put it to standard out to confirm I could read and write UTF8 properly, before creating the strings and make all the HTTP requests.</p>
  
  <p>The <code>test1.txt</code> file I made contained just this contents:</p>
  
  <blockquote>
    <p>Öwnägé</p>
  </blockquote>
  
  <p>I then used this C# code to read in the file.  I set the <code>StreamReader</code> encoding and the <code>Console.OutputEncoding</code> to <code>UTF8</code>.</p>
  
  <pre><code>static void Main(string[] args)
  {
      Console.OutputEncoding = System.Text.Encoding.UTF8;
  
      using (StreamReader reader = new StreamReader("test1.txt",System.Text.Encoding.UTF8))
      {
          string line;
  
          while ((line = reader.ReadLine()) != null)
          {
              Console.WriteLine(line);
          }
  
      }
  
      Console.ReadLine();
  }
  </code></pre>
  
  <p>Much to my surprise I get this kind of output:</p>
  
  <p><img src="https://i.stack.imgur.com/c9Cpy.png" alt="enter image description here"></p>
  
  <p>Expected output is the exact same as the original file contents.</p>
  
  <p>How can I be certain that the strings I am going to build to make HTTP requests are going to be correct if I cannot even do a simple task as read/write UTF8 strings?</p>