title: Writing UTF-8 String to MySQL with Python
body: <p>I am trying to push user account data from an Active Directory to our MySQL-Server. This works flawlessly but somehow the strings end up showing an encoded version of umlauts and other special characters.</p>
  
  <p>The Active Directory returns a string using this sample format: <code>M\xc3\xbcller</code></p>
  
  <p>This actually is the UTF-8 encoding for <code>Müller</code>, but I want to write <code>Müller</code> to my database not <code>M\xc3\xbcller</code>.</p>
  
  <p>I tried converting the string with this line, but it results in the same string in the database:
  <code>tempEntry[1] = tempEntry[1].decode("utf-8")</code></p>
  
  <p>If I run <code>print "M\xc3\xbcller".decode("utf-8")</code> in the python console the output is correct.</p>
  
  <p>Is there any way to insert this string the right way? I need this specific format for a web developer who wants to have this exact format, I don't know why he is not able to convert the string using PHP directly.</p>
  
  <p>Additional info: I am using MySQLdb; The table and column encoding is utf8_general_ci</p>