SyntaxError: encoding problem: with BOM

Diez B. Roggisch deets at nospam.web.de
Wed Dec 24 11:35:13 EST 2008


NoName schrieb:
> On 25 дек, 00:37, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
>> NoName schrieb:
>>
>>> i have 1.py in cp866 encoding:
>>> # -*- coding: cp866 -*-
>>> print ("ff")
>>> It's not work in Python 3.0
>>> Error:
>>> File "<decoding error>", line 1
>>> SyntaxError: encoding problem: with BOM
>>> what's wrong?
>> I can only guess, but just because you write the coding-header that
>> doesn't mean that the editor you use does actually *use* that encoding.
>> What I presume it does is to use utf-8, and write that stupid BOM
>> microsoft uses for denoting utf-8-content as first byte. Try using a
>> different editor, or alter it's settings to really use your desired
>> encoding.
>>
>> Diez
> 
> I used Far Manager editor. and it *really* used cp866
> I can print hex dump of source file.
> I don't want to use UTF-8 for py-file!

How about you show us the python file in question?

diez



More information about the Python-list mailing list