[Python-ideas] Add "namereplace" error handler
Serhiy Storchaka
storchaka at gmail.com
Tue Jun 11 16:54:48 CEST 2013
11.06.13 16:33, M.-A. Lemburg написав(ла):
> One detail such an error handler would have to define is
> what to use in case no name is defined.
>
>>>> unicodedata.lookup(unichr(13))
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> KeyError: "undefined character name '\r'"
>
> Since the handler should probably be round-trip safe, I
> guess falling back to the \u backslash notation would be
> appropriate.
"namereplace" produces output which can be interpreted as Python
literal. Therefore fallback to "backslashreplace" looks reasonable.
More information about the Python-ideas
mailing list