codec for UTF-8 with BOM

Ulrich Eckhardt ulrich.eckhardt at dominolaser.com
Mon May 2 06:30:46 EDT 2011


Chris Rebert wrote:
>> 3. The docs mention encodings.utf_8_sig, available since 2.5, but I can't
>> locate that thing there either. What's going on here?
> 
> Works for me™:
> Python 2.6.6 (r266:84292, Jan 12 2011, 13:35:00)
> [GCC 4.2.1 (Apple Inc. build 5664)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from encodings import utf_8_sig
>>>>

This works for me, too. What I tried and what failed was

  import encodings
  encodings.utf_8_sig

which raises an AttributeError or dir(encodings), which doesn't show the 
according element. If I do it your way, the encoding then shows up in the 
content of the module.

Apart from the encoding issue, I don't understand this behaviour. Is the 
module behaving badly or are my expectations simply flawed?


Thanks!

Uli

-- 
Domino Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list