title: Sanitizing UTF-8 encoded strings
body: <p>I want to sanitise a UTF-8 encoded string before using it as part of a MySQL SELECT statement.</p>
  
  <p>For example, I have:</p>
  
  <pre><code>query = MySQLdb.escape_string(query)
  </code></pre>
  
  <p>but this line is leading to a raised exception that reads </p>
  
  <blockquote>
    <p>'ascii' codec can't encode characters in position 0-2: ordinal not in
    range(128).</p>
  </blockquote>
  
  <p>How can I handle this?</p>