SyntaxError: encoding problem: with BOM

Diez B. Roggisch deets at nospam.web.de
Wed Dec 24 08:37:33 EST 2008


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



More information about the Python-list mailing list