[Python-Dev] Encoding detection in the standard library? (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Tue Apr 22 06:30:33 CEST 2008


IMO, encoding estimation is something that many web programs will have to deal with

Can you please explain why that is? Web programs should not normally have the need to detect the encoding; instead, it should be specified always - unless you are talking about browsers specifically, which need to support web pages that specify the encoding incorrectly.

so it might as well be built in; I would prefer the option to run text=input.encode('guess') (or something similar) than relying on an external dependency or worse yet using a hand-rolled algorithm.

Ok, let me try differently then. Please feel free to post a patch to bugs.python.org, and let other people rip it apart.

For example, I don't think it should be a codec, as I can't imagine it working on streams.

Regards, Martin



More information about the Python-Dev mailing list