[Python-Dev] XML codec?

Stephen J. Turnbull stephen at xemacs.org
Sat Nov 10 01:20:53 CET 2007


"Martin v. Löwis" writes:

 > > It's clear to me that detecting an encoding is actually the simplest
 > > part of all this (so long as there's an API to do it!)  Putting it
 > > inside a codec seems like the wrong subdivision of responsibility.
 > 
 > In case it isn't clear - this is exactly my view also.

But is there an API to do it?  As MAL points out that API would have
to return not an encoding, but a pair of an encoding and the rewound
stream.  For non-seekable, non-peekable streams (if any), what you'd
need would be a stream that consisted of a concatenation of the
buffered data used for detection and the continuation of the stream.



More information about the Python-Dev mailing list