[Python-Dev] XML codec?

M.-A. Lemburg mal at egenix.com
Fri Nov 9 23:59:46 CET 2007


Martin v. Löwis wrote:
>> It makes working with XML data a lot easier: you simply don't have to
>> bother with the encoding of the XML data anymore and can just let the
>> codec figure out the details. The XML parser can then work directly
>> on the Unicode data.
> 
> Having the functionality indeed makes things easier. However, I don't
> find
> 
>   s.decode(xml.detect_encoding(s))
> 
> particularly more difficult than
> 
>   s.decode("xml-auto-detection")

Not really, but the codec has more control over what happens to
the stream, ie. it's easier to implement look-ahead in the codec
than to do the detection and then try to push the bytes back onto
the stream (which may or may not be possible depending on the
nature of the stream).

>> Whether it needs to be in C or not is another question (I would have
>> done this in Python since performance is not really an issue), but since
>> the code is already written, why not use it ?
> 
> It's a maintenance issue.

I'm sure Walter will do a great job in maintaining the code :-)

Regards,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Nov 09 2007)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611


More information about the Python-Dev mailing list