unicode转string是encode,string转unicode是decode
用utf-8和utf8是一样的
不信你把上面的代码放进python2里面试试。
import sys
reload(sys)
sys.setdefaultencoding('utf8')
x = u'中国'
y = x.encode('utf-8')
z = y.decode('utf-8')
a = u'中国'
b = a.encode('utf8')
c = b.decode('utf8')