If I have an unknown object X with some method of getting a string representation (__unicode__
, __str__
, __repr__
, etc.).
How can I safely convert that object to a unicode string without ever having to worry about seeing any of those ugly unicode encode/decode errors?