Determining encoding of a file

Ben Finney bignose+hates-spam at benfinney.id.au
Sat Feb 3 16:03:31 EST 2007


Tony Houghton <h at realh.co.uk> writes:

> In Linux it's possible for filesystems to have a different encoding
> from the system's setting. Given a filename, is there a (preferably)
> portable way to determine its encoding?

If there were, PEP 263 would not be necessary.

    <URL:http://www.python.org/dev/peps/pep-0263/>

It's possible to *guess*, with no guarantee of getting the right
answer; but it's far better to be explicitly *told* what the encoding
is.

-- 
 \         "If we don't believe in freedom of expression for people we |
  `\         despise, we don't believe in it at all."  -- Noam Chomsky |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list