[Python-Dev] XML codec?
Fred Drake
fdrake at acm.org
Mon Nov 12 16:23:50 CET 2007
On Nov 12, 2007, at 8:56 AM, Walter Dörwald wrote:
> It isn't "embedded". codecs.detect_xml_encoding() is callable without
> any problems (though not documented).
"Not documented" means not available, I think.
> Who would use such a function for what?
Being able to detect the encoding can be useful anytime you want
information about a file, actually. In particular, presenting
encoding information in a user interface (yes, you can call that
contrived, but some people want to be able to see such things, and for
them it's a requirement). If you want to parse the XML and re-encode,
it's common to want to re-encode in the origin encoding; it's needed
for that as well. If you just want to toss the text into an editor,
the encoding is also needed. In that case, the codec approach *might*
be acceptable (depending on the rest of the editor implementation),
but the same re-encoding issue applies as well.
Simply, it's sometimes desired to know the encoding for purposes that
don't require immediate decoding. A function would be quite handing
in these cases.
-Fred
--
Fred Drake <fdrake at acm.org>
More information about the Python-Dev
mailing list