title: mysql-python collation issue: how to force unicode datatype?
body: <p>For certain purposes I had to change field collations from <code>utf8_unicode_ci</code> to <code>utf8_bin</code> in a database. It turned out that the change lead to changes in datatypes that come to python. </p>
  
  <p>The question is <strong>how to force mysql-python to return unicode objects to python</strong>.</p>
  
  <p>Here is a sample that shows the problem (explicit charset forces use_unicode=1):</p>
  
  <pre><code>&gt;&gt;&gt; con = MySQLdb.connect(..., charset='utf8')
  &gt;&gt;&gt; c = c.cursor()
  &gt;&gt;&gt; c.execute('SELECT %s COLLATE utf8_bin', u'м')
  1L
  &gt;&gt;&gt; c.fetchone()
  ('\xd0\xbc',)
  &gt;&gt;&gt; c.description
  (("'\xd0\xbc' COLLATE utf8_bin", 253, 2, 3, 3, 31, 0),)
  
  
  &gt;&gt;&gt; c.execute('SELECT %s COLLATE utf8_unicode_ci', u'м')
  1L
  &gt;&gt;&gt; c.fetchone()
  (u'\u043c',)
  &gt;&gt;&gt; c.description
  (("'\xd0\xbc' COLLATE utf8_unicode_ci", 253, 2, 3, 3, 31, 0),)
  </code></pre>
  
  <p>In my database the fields are of type VARCHAR, but after the change they behave like BINARY which is not what I want.</p>