This is my code:
print \'哈哈\'.decode(\'gb2312\').encode(\'utf-8\')
...and it prints:
SyntaxError: Non-ASCII character \'\\x
You need to specify the encoding of the python source code file, here is the coding for utf-8. It goes at the top right underneath the path the the python interpreter.
#!/usr/bin/python
# -*- coding: utf-8 -*-
If you go to the url in the error message you can find more information about specifying the encoding of a python source file.
Once you specify the encoding of the source file, you shouldn't have to decode the text.