title: MySQL select UTF-8 string with '=' but not with 'LIKE'
body: <p>I have a table with some words that come from medieval books and have some accented letters that doesn't exists anymore in modern latin1 alphabet. I can represent these letters easily with UTF-8 combining characters. For example, to create a "J" with a tilde, I use the UTF-8 sequence \u004A+\u0303 and the J becomes accented with a tilde.</p>
  
  <p>The table uses utf8 encoding and the field collation is utf8_unicode_ci.</p>
  
  <p>My problem is the following: If I try to select the entire string, I receive the correct answer. If I try to select using 'LIKE', I receive the wrong answer.</p>
  
  <p>For example:</p>
  
  <pre><code>mysql&gt; select word, hex(word) from oldword where word = 'hua';
  +--------+--------------+
  | word   | hex(word)    |
  +--------+--------------+
  | hũa    | 6875CC8361   |
  | huã    | 6875C3A3     |
  | hua    | 687561       |
  | hũã    | 6875CC83C3A3 |
  +--------+--------------+
  4 rows in set (0,04 sec)
  
  mysql&gt; select word, hex(word) from oldword where word like 'hua';
  +-------+------------+
  | word  | hex(word)  |
  +-------+------------+
  | huã   | 6875C3A3   |
  | hua   | 687561     |
  +-------+------------+
  2 rows in set (0,04 sec)
  </code></pre>
  
  <p>I don't want to search only the entire word. I want to search words that start with some substring. Eventually the searched word is the entire word.</p>
  
  <p>How could I select the partial string using like and match all the strings?</p>
  
  <p>I tried to create a custom collation using <a href="http://dev.mysql.com/doc/refman/5.0/en/adding-collation-unicode-uca.html" rel="nofollow">this information</a>, but the server became unstable and only after a lot of trials and errors I was able to revert to the utf8_unicode_ci collation again and the server returned to normal condition.</p>
  
  <p><strong>EDIT:</strong> There's a problem with this site and some characters don't display correctly. Please see the results on these pastebins:</p>
  
  <p><a href="http://pastebin.com/mckJTLFX" rel="nofollow">http://pastebin.com/mckJTLFX</a></p>
  
  <p><a href="http://pastebin.com/WP87QvgB" rel="nofollow">http://pastebin.com/WP87QvgB</a></p>