[I18n-sig] XML and codecs

Walter Doerwald walter@livinglogic.de
Thu, 07 Jun 2001 22:27:33 +0200


On 07.06.01 at 11:53 Walter Doerwald wrote:

> On 06.06.01 at 17:57 M.-A. Lemburg wrote:
> 
> > [...]
> > > Do we want error handling callbacks?
> > 
> > I think we should still keep them on the TODO list.
> 
> OK! Then I'll start playing around with it.

I started working on this, and it's progressing nicely.
It's already possible to do things like:

>>> import codecs
>>> codecs.ascii_encode(
...     u"a=E4u=FCo=F6=DF",
...     lambda enc, uni, pos: u"&#x%x;" % ord(uni[pos]))=
                          
('aäuüoöß', 7)
>>> import unicodedata
>>> codecs.latin_1_encode(
...     u"a\u3042b",
...     lambda enc, uni, pos: u"<%s>" % unicodedata.name(uni[pos]))
('a<HIRAGANA LETTER A>b', 3)

String arguments are still accepted:
>>> codecs.ascii_encode(u"a=E4u=FCo=F6=DF", "ignore") 
('auo', 7)


Bye,
   Walter D=F6rwald

-- 
Walter D=F6rwald =B7 LivingLogic AG =B7 Bayreuth, Germany =B7=
 www.livinglogic.de