[Python-Dev] XML codec? (original) (raw)
Fred Drake fdrake at acm.org
Mon Nov 12 16:23:50 CET 2007
- Previous message: [Python-Dev] XML codec?
- Next message: [Python-Dev] XML codec?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Nov 12, 2007, at 8:56 AM, Walter Dörwald wrote:
It isn't "embedded". codecs.detectxmlencoding() 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
- Previous message: [Python-Dev] XML codec?
- Next message: [Python-Dev] XML codec?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]