[XML-SIG] Re: [4suite] Output encodings again

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed, 13 Sep 2000 13:11:08 +0200

> It's not really all that hard to write codecs for Python 2.0.
> You'll have to do two things:
> 1. write the codec by subclassing the base classes in codecs.py
> 2. write a search function which returns the needed constructors
>    and functions.

So how would I write a codec that converts all characters to Latin-1,
and converts those out of latin-1 to &#xxx; (instead of the
replacement character)? I'd need knowledge about what character are in
Latin-1, and I'd need to do conversion on a character-by-character
basis, right? And I can't possible use any of the _codecs helper

This is certainly feasible if I want it for a single character set,
but now if I want to do it wholesale for the entire set of character
sets supported by Python 2.0.