1 2 3 4 5 6
class Foo(object): def __unicode__(self): return str('Hallo') unicode(Foo()) unicode(Foo(), errors='replace')
1 2 3 4
Traceback (most recent call last): Line 6, in <module> unicode(Foo(), errors='replace') TypeError: coercing to Unicode: need string or buffer, Foo found