title: Python how to decode unicode with hex characters
body: <p>I have extracted a string from web crawl script as following:</p>
  
  <pre><code>u'\xe3\x80\x90\xe4\xb8\xad\xe5\xad\x97\xe3\x80\x91'
  </code></pre>
  
  <p>I want to decode <code>u'\xe3\x80\x90\xe4\xb8\xad\xe5\xad\x97\xe3\x80\x91'</code> with utf-8.
  With <a href="http://ddecode.com/hexdecoder/" rel="noreferrer">http://ddecode.com/hexdecoder/</a>, I can see the result is <code>'【中字】'</code></p>
  
  <p>I tried using the following syntax but failed.</p>
  
  <pre><code>msg = u'\xe3\x80\x90\xe4\xb8\xad\xe5\xad\x97\xe3\x80\x91'
  result = msg.decode('utf8')
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
      return codecs.utf_8_decode(input, errors, True)
  UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-11: ordi
  nal not in range(128)
  </code></pre>
  
  <p>May I ask how to decode the string correctly?</p>
  
  <p>Thanks for help.</p>