title: MySQL's INSTR and collations
body: <p>EDIT 3: OK, forget all the complicated stuff below. My question is as easy as this: Why is the second column of the following result set 0 while all other columns are 1.</p>
  
  <pre><code>SELECT 'a' = 'á',
         INSTR('András','Andras'), 
         'András' LIKE 'Andras',
         INSTR('András','Andräs')
  </code></pre>
  
  <p>The database and connection is set to utf8.</p>
  
  <p>END EDIT</p>
  
  <p>I've got an issue with MySQL's INSTR function. I have a table 'values' with collation utf8_general_ci and a VARCHAR column 'value' containing the value 'András Schiff'. Now I perform the following queries:</p>
  
  <pre><code>&gt; SET NAMES 'utf8' COLLATE 'utf8_general_ci'
  &gt; SELECT 'a' = 'á';
  1
  &gt; SELECT * FROM values WHERE value LIKE '%Andras%'
  'András'
  &gt; SELECT * FROM values WHERE INSTR(value,'Andras')
  (Empty)
  &gt; SELECT * FROM values WHERE INSTR(value,'Andräs')
  'András'
  </code></pre>
  
  <p>Can anyone explain this strange behavior? I thought LIKE '%...%' and INSTR were equivalent, the latter having the advantage that the search string may contain '%'. </p>
  
  <p>Thanks</p>
  
  <p>EDIT: My MySQL version is Ver 14.14 Distrib 5.1.54, for debian-linux-gnu (x86_64) using readline 6.2</p>
  
  <p>EDIT 2: Another thing I noticed:</p>
  
  <pre><code>&gt; SELECT * FROM values WHERE INSTR(value,'Andras') COLLATE 'utf8_unicode_ci'
  </code></pre>
  
  <p>gives an error "COLLATION 'utf8_unicode_ci' is not valid for CHARACTER SET 'binary'". But I don't understand why the character set should be binary.</p>