Anything like 'inspect.getsourceencoding()'?
jepler at unpythonic.net
Sun Oct 17 15:35:14 CEST 2004
On Sat, Oct 16, 2004 at 10:30:05PM -0700, Robert Brewer wrote:
> Jeff Epler wrote:
> > Is there a convenient way to find the encoding of a source file?
> Short answer: no, you have to guess. But check out some good guessing
> algorithms at e.g. http://manatee.mojam.com/~skip/python/decodeh.py
Python doesn't guess: it refers to a specially-formatted line that
names the encoding (PEP 263).
It was access to this metadata that I was hoping to find through the
I agree that for general, unknown text files you have to guess. (and
I'll thank myself some day if I save the URL you mentioned)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
More information about the Python-list