my system:xp+python27 the codec, xp gbk;python 27 ascii

 a = '你好'
a
'\xc4\xe3\xba\xc3'
print a
你好
'\xc4\xe3\xba\xc3'.decode('gbk')
u'\u4f60\u597d'
'\xc4\xe3\xba\xc3'.encode('gbk')
Traceback (most recent call last): File "", line 1, in UnicodeDecodeError:
'ascii' codec can't decode byte 0xc4 in position 0: ordinal not in
range(128)

 how can i get "你好" from '\xc4\xe3\xba\xc3' ?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to