Message36788
Logged In: YES
user_id=89016
New version of the patch with the error handling callback
registry.
> > OK, done, now there's a
> > PyCodec_EscapeReplaceUnicodeEncodeErrors/
> > codecs.escapereplace_unicodeencode_errors
> > that uses \u (or \U if x>0xffff (with a wide build
> > of Python)).
>
> Great!
Now PyCodec_EscapeReplaceUnicodeEncodeErrors uses \x
in addition to \u and \U where appropriate.
> > [...]
> > But for special one-shot error handlers, it might still
be
> > useful to pass the error handler directly, so maybe we
> > should leave error as PyObject *, but implement the
> > registry anyway?
>
> Good idea !
>
> One minor nit: codecs.registerError() should be named
> codecs.register_errorhandler() to be more inline with
> the Python coding style guide.
OK, but these function are specific to unicode encoding,
so now the functions are called:
codecs.register_unicodeencodeerrorhandler
codecs.lookup_unicodeencodeerrorhandler
Now all callbacks (including the new
ones: "xmlcharrefreplace"
and "escapereplace") are registered in the
codecs.c/_PyCodecRegistry_Init so using them is really
simple: u"gürk".encode("ascii", "xmlcharrefreplace")
|
|
Date |
User |
Action |
Args |
2007-08-23 15:06:06 | admin | link | issue432401 messages |
2007-08-23 15:06:06 | admin | create | |
|