newbie with a encoding question, please help
Stefan Behnel
stefan_ml at behnel.de
Thu Apr 1 08:16:01 EDT 2010
Mister Yu, 01.04.2010 13:38:
> i m still not very sure how to convert a unicode object **
> u'\xd6\xd0\xce\xc4 ** back to "中文" the string it supposed to be?
You are confused. '\xd6\xd0\xce\xc4' is an encoded byte string, not a
unicode string. The fact that you have it stored in a unicode string
implies that something in your code (or in a library) has done an incorrect
conversion from bytes to unicode that did not take into account the real
character set in use. So you end up with a completely meaningless unicode
string.
Please show us the code that does the conversion to a unicode string.
Stefan
More information about the Python-list
mailing list