Kanji characters in utf-8
python, unicode, utf-8
Solution
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")
Problem
``` >>> 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?