encoding of a file

Thomas Thomas thomas at mindz-i.co.nz
Fri Aug 4 00:24:57 EDT 2006


Hi All,

how can I find the encoding to use to open a file.. I have a file with "£" chararcter..
is there some utility function in python that I can use

how can I know which encoding to use

f=codecs.open(filename, "r", encoding='iso-8859-1')
or
f=codecs.open(filename, "r", encoding='latin-1')
or
f=codecs.open(filename, "r", encoding='utf-8')

sys.defaultencoding gives ascii and I know that's not the one to use 

cheers
-----------------------------------------------------
Thomas Thomas
thomas at mindz-i.co.nz
Phone.  +64 7 855 8478
Fax.      +64 7 855 8871
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060804/f09a90a7/attachment.html>


More information about the Python-list mailing list