writing \feff at the begining of a file
eckhardt at satorlaser.com
Fri Aug 13 12:43:44 CEST 2010
Jean-Michel Pichavant wrote:
> My problem is however simplier : how do I add such character [a BOM]
> at the begining of the file ?
> I tried
> f = open('paf', w)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\ufeff' in
> position 0: ordinal not in range(128)
Try the codecs module to open the file, which will then do all the
transcoding between internal texts and external UTF-8 for you.
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
More information about the Python-list