Writing new codecs

Brian Quinlan brian at sweetapp.com
Sat Jun 23 15:43:58 EDT 2001


I just finished writing a UTF-7 codec for inclusion in unicodeobject.c.
However, it would be nice to expose some features not available as part
of the regular encoding interface. Namely, I would like to allow the
caller to specify whether the encoder should escape whitespace and other
characters likely to cause problems when transmitted over e-mail
gateways (Set O as described in RFC2152). Would using keyword arguments
be acceptable?

e.g.

'Test\n\r'.encode( 'utf-7', 'strict', encodewhitespace=1, encodeseto=0)

AFAIK, the only change I would have to make is in my utf7_encode
function in _codecsmodule.c.

Cheers,
Brian





More information about the Python-list mailing list