Anything like 'inspect.getsourceencoding()'?

Just just at
Sun Oct 17 10:12:13 CEST 2004

In article <mailman.5071.1097991055.5135.python-list at>,
 "Robert Brewer" <fumanchu at> 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.

You don't have to guess if the file has a

# -*- coding: encoding -*-

line. Such a line is required anyway, as of Python 2.3, if the source 
file contains non-ascii chars.


More information about the Python-list mailing list