[Python-Dev] XML codec? (original) (raw)
Walter Dörwald walter at livinglogic.de
Tue Nov 13 13:01:55 CET 2007
- Previous message: [Python-Dev] XML codec?
- Next message: [Python-Dev] XML codec?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Fred Drake wrote:
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.
I just din't think that someone wants the detection function, but not the codec, so I left the function undocumented.
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).
And if you want to display the XML you'd need to decode it. An example might be a text viewer. E.g. Apples QuickLook.
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.
So the consensus seems to be: Add an encoding detection function (implemented in Python) to the xml module?
Servus, Walter
- Previous message: [Python-Dev] XML codec?
- Next message: [Python-Dev] XML codec?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]