title: How do I convert unicode string with cp1252 characters into UTF-8 with Python?
body: <p>I am getting text through an API that returns characters with a windows encoded apostrophe (\x92):</p>
  
  <pre><code>&gt; python
  &gt;&gt;&gt; title = u'There\x92s thirty days in June'
  &gt;&gt;&gt; title
  u'There\x92s thirty days in June'
  &gt;&gt;&gt; print title
  Theres thirty days in June
  &gt;&gt;&gt; type(title)
  &lt;type 'unicode'&gt;
  </code></pre>
  
  <p>I'm trying to convert this string to UTF-8 so that it instead returns: "There’s thirty days in June"</p>
  
  <p>When I try to decode or encode this unicode string, it throws an error:</p>
  
  <pre><code>&gt;&gt;&gt; title.decode('cp1252')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/cp1252.py", line 15, in decode
      return codecs.charmap_decode(input,errors,decoding_table)
  UnicodeEncodeError: 'ascii' codec can't encode character u'\x92' in position 5: ordinal not in range(128)
  
  &gt;&gt;&gt; title.encode("cp1252").decode("utf-8")
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/cp1252.py", line 12, in encode
      return codecs.charmap_encode(input,errors,encoding_table)
  UnicodeEncodeError: 'charmap' codec can't encode character u'\x92' in position 5: character maps to &lt;undefined&gt;
  </code></pre>
  
  <p>If I were to initialize the string as plain-text and then decode it, it works:</p>
  
  <pre><code>&gt;&gt;&gt;title = 'There\x92s thirty days in June'
  &gt;&gt;&gt; type(title)
  &lt;type 'str'&gt;
  &gt;&gt;&gt;print title.decode('cp1252')
  There’s thirty days in June
  </code></pre>
  
  <p>My question is how do I convert the unicode string that I'm getting into a plain-text string so that I can decode it?</p>