title: Ruby, problems comparing strings with UTF-8 characters
body: <p>I have these 2 UTF-8 strings:</p>
  
  <pre><code>a = "N\u01b0\u0303"
  b = "N\u1eef"
  </code></pre>
  
  <p>They look pretty different but the are the same once they are rendered:</p>
  
  <pre><code>irb(main):039:0&gt; puts "#{a} - #{b}"
  Nữ - Nữ
  </code></pre>
  
  <p>The <em>a</em> version is the one I have stored in the DB. The <em>b</em> version is the one is coming from the browser in a POST request, I don't know why the browser is sending a different combination of UTF8 characters, and it is not happening always, I can't reproduce the issue in my dev environment, it happens in production and in a percentage of the total requests. </p>
  
  <p>The case is that I try to compare both of them but they return <code>false</code>:</p>
  
  <pre><code>irb(main):035:0&gt; a == b
  =&gt; false
  </code></pre>
  
  <p>I've tried different things like <em>forcing encoding</em>: </p>
  
  <pre><code>irb(main):022:0&gt; c.force_encoding("UTF-8") == a.force_encoding("UTF-8")
  =&gt; false
  </code></pre>
  
  <p>Another interesting fact is:</p>
  
  <pre><code>irb(main):005:0&gt; a.chars
  =&gt; ["N", "ư", "̃"]
  irb(main):006:0&gt; b.chars
  =&gt; ["N", "ữ"]
  </code></pre>
  
  <p>How can I compare these kind of strings?</p>