[Python-Dev] XML codec?

"Martin v. Löwis" martin at v.loewis.de
Thu Nov 8 07:05:48 CET 2007


> Any comments?

-1. First, (as already discussed on the tracker,) "xml" is a bad name
for an encoding. How would you encode "Hello" "in xml"?

Then, I'd claim that the problem that the codec solves doesn't really
exist. IOW, most XML parsers implement the auto-detection of encodings,
anyway, and this is where architecturally this functionality belongs.
For a text editor, much more useful than a codec would be a routine
(say, xml.detect_encoding) which performs the auto-detection.

Finally, I think the codec is incorrect. When saving XML to a file
(e.g. in a text editor), there should rarely be encoding errors, since
one could use character references in many cases. Also, the XML
spec talks about detecting EBCDIC, which I believe your implementation
doesn't.

Regards,
Martin


More information about the Python-Dev mailing list