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) > f.write(u'\ufeff') > > 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. Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list