>>> s='未作評級'
>>> s
'\xe6\x9c\xaa\xe4\xbd\x9c\xe8\xa9\x95\xe7\xb4\x9a'
>>> s = unicode(s)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
How would I get the 未作評級 into uniciode?
Either use a Unicode string from the start:
>>> s = u'未作評級'
or decode the string from its current encoding (which appears to be UTF-8). Then you get a Unicode string.
>>> s = '未作評級'.decode("utf-8")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With