title: Incorrect Encoding Causing Problems with DB Query
body: <p>It's late and my caffeine IV is running low so my mind is mush and I'm having problems finding a solution to what I think is a simple encoding problem (which I have almost no experience dealing with).  </p>
  
  <p>I have a DB using EF6 Code First and everything seems to work well until I copy some text from a website forum contained within a codeblock.  I checked the header and it's supposedly encoded in UTF-8.</p>
  
  <p>I essentially take this text, split it to an array of strings and check the DB for a record matching the string in each line.  Everything was going well until I hit a problem with a string "Magnеtic" not matching up to anything in my DB table yet when I went into the SQLMS and queried the table with LIKE '%Magnеtic%' I got a result.</p>
  
  <p>I dropped the text from the website into Notepad++ with the text from the DB query and saw that they look equal:</p>
  
  <pre><code>Magnеtic
  Magnеtic
  </code></pre>
  
  <p>Then, I changed the encoding to ANSI and it showed:</p>
  
  <pre><code>Magnetic   &lt;--From DB
  MagnÐµtic  &lt;--From website
  </code></pre>
  
  <p>A tiny light bulb went on in my head but my attempts to remedy this issue has failed.</p>
  
  <p>I've tried using various methods but I think it's my fried brain attacking the problem with the wrong tools:</p>
  
  <pre><code>string.compare(a, b) == 0
  string.equals(a, b)
  string.ToUpperInvariant()
  </code></pre>
  
  <p>and probably a few others that I can't remember.</p>
  
  <p>So now you know what my issue is and I feel this is such a simple problem to fix but, like I said, I'm fried and now need some community help.</p>
  
  <p>I'm not a professional coder, more a hobbyist so I may not be using best practices or advanced techniques to do some things.</p>
  
  <p>Edit:
  Today I did some more searching and found a couple of methods that didn't work.</p>
  
  <pre><code>private string RemoveAccent(string txt)
  {
       byte[] bytes = Encoding.GetEncoding("Cyrillic").GetBytes(txt);
       return Encoding.ASCII.GetString(bytes);
  }
  </code></pre>
  
  <p>This one appears to remove the accented characters of the Cyrillic encoding.  The result wasn't as expected but it DID have an effect.
  Results:</p>
  
  <pre><code>Magn?tic &lt;- Computer interpretation
  Magnetic &lt;- Visual representation
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>private string RemoveAccent2(string txt)
  {
      char[] toReplace = "àèìòùÀÈÌÒÙ äëïöüÄËÏÖÜ âêîôûÂÊÎÔÛ áéíóúÁÉÍÓÚðÐýÝ ãñõÃÑÕšŠžŽçÇåÅøØ".ToCharArray();
      char[] replaceChars = "aeiouAEIOU aeiouAEIOU aeiouAEIOU aeiouAEIOUdDyY anoANOsSzZcCaAoO".ToCharArray();
      for (int i = 0; i &lt; toReplace.Count(); i++)
      {
          txt = txt.Replace(toReplace[i], replaceChars[i]);
      }
      return txt;
  }
  </code></pre>
  
  <p>This method didn't provide any changes.</p>