[Python-3000] Pre-PEP: Easy Text File Decoding

Walter Dörwald walter at livinglogic.de
Mon Sep 11 12:00:38 CEST 2006

Paul Prescod wrote:

> I went based on the current setdefaultencoding. But it seems that we will
> accumulate 3 or 4 related functions so I'm pursuaded that there should be a
> module.
> encodingdetection.setdefaultfileencoding
> encodingdetection.registerencodingdetector
> encodingdetection.guessfileencoding(filename)
> encodingdetection.guessfileencoding(bytestream)
> Suggestion accepted.

There's no need for implementing a separate infrastructure for encoding detection. This can be implemented as a "meta codec".
See http://styx.livinglogic.de/~walter/xml_codec/xml_codec.py for a codec that autodetects the XML encoding.


More information about the Python-3000 mailing list