title: Python unicode string with UTF-8?
body: <p>I'm getting back from a library what looks to be an incorrect unicode string:</p>
  
  <pre><code>&gt;&gt;&gt; title
  u'Sopet\xc3\xb3n'
  </code></pre>
  
  <p>Now, those two hex escapes there are the UTF-8 encoding for U+00F3 LATIN SMALL LETTER O WITH ACUTE.  So far as I understand, a unicode string in Python should have the actual character, not the the UTF-8 encoding for the character, so I think this is incorrect and presumably a bug either in the library or in my input, right?</p>
  
  <p>The question is, how do I (a) recognize that I have UTF-8 encoded text in my unicode string, and (b) convert this to a proper unicode string?</p>
  
  <p>I'm stumped on (a), as there's nothing wrong, encoding-wise, about that original string (i.e, both are valid characters in their own right, <code>u'\xc3\xb3'</code> == Ã³, but they're not what's supposed to be there)</p>
  
  <p>It looks like I can achieve (b) by eval()ing that repr() output minus the "u" in front to get a str and then decoding the str with UTF-8:</p>
  
  <pre><code>&gt;&gt;&gt; eval(repr(title)[1:]).decode("utf-8")
  u'Sopet\xf3n'
  &gt;&gt;&gt; print eval(repr(title)[1:]).decode("utf-8")
  Sopetón
  </code></pre>
  
  <p>But that seems a bit kludgy.  Is there an officially-sanctioned way to get the raw data out of a unicode string and treat that as a regular string?</p>