为何**解码**期间的UnicodeEncodeError?

时间:2017-01-10 11:28:17

标签: python python-unicode

解码期间为何UnicodeEncodeError

我估计得到UnicodeDecodeError

>>> u'\udcc3'.decode('utf8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/foo_x_d/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\udcc3' in position 0: ordinal not in range(128)

0 个答案:

没有答案