??????????????? wrote: > But the string contained the u'\u20ac' is get from remote host. Is > there any method to decode it to the local 'mbcs'?
remote_string = u'\u20ac' try: local_string = remote_string.encode('mbcs') except: # no mbcs equivalent available print "encoding error" else: # local_string is now an 8-bit string print "result:", local_string # if console is not mbcs, you should see incorrect result assert result == '\x80' Mbcs is windows-only so I couldn't test this. If your application handles text, it may be easier to just leave everything in Unicode and encode to utf-8 for storage? Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list