Anything like 'inspect.getsourceencoding()'?

Jeff Epler jepler at
Sun Oct 17 04:14:34 CEST 2004

Is there a convenient way to find the encoding of a source file?  I
thought maybe this would be in the inspect module, but I didn't see it
there.  Just as nice would be a way to get the file as a unicode string,
I suppose.

(This is related to another thread I've recently posted to, where
another user was having trouble with pydoc's links to source files using
the file: protocol.  I suggested having pydoc serve the source files,
and provided a patch, but it's crossed my mind that it would be nice to
tell the browser the encoding of that file.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list