Lookuperror : unknown encoding : utf-8

Leo Kislov Leo.Kislov at gmail.com
Mon Oct 30 08:42:48 CET 2006

Sachin Punjabi wrote:
> Hi,
> I wanted to read a file encoded in utf-8 and and using the following
> syntax in my source which throws me an error specifying Lookuperror :
> unknown encoding : utf-8. Also I am working on Python version 2.4.1.
> import codecs
> fileObj = codecs.open( "data.txt", "r", "utf-8" )
> Can anyone please guide me how do I get utf-8 activated in my codecs or
> any setting needs to be done for the same before using codecs.

What OS? Where did you get your python distribution? Anyway, I believe
utf-8 codec was in the python.org distribution since the introduction
of unicode (around python 2.0). If you can't use utf-8 codec right out
of the box, something is really wrong with your setup.

  -- Leo

More information about the Python-list mailing list