Unicode error handler
Hieu.D.Hoang at gmail.com
Hieu.D.Hoang at gmail.com
Tue Jan 30 23:21:49 EST 2007
On Jan 30, 11:28 pm, Walter Dörwald <wal... at livinglogic.de> wrote:
>
> codecs.register_error("transliterate", transliterate)
>
> Walter
Really, really slick solution.
Though, why was it [:1], not [0]? ;-)
And one more thing:
> def transliterate(exc):
> if not isinstance(exc, UnicodeEncodeError):
> raise TypeError("don'ty know how to handle %r" % r)
I don't understand what %r and r are and where they are from. The man
3 printf page doesn't have %r formatting.
Thanks for the tip.
Hieu
More information about the Python-list
mailing list