I wrote a simple html parsing class in python and it seems to work fine and then I try to use it with django and I get this error:
'ascii' codec can't decode byte 0xc2 in position 54465: ordinal not in range(128)
which is strange because I added this: # encoding: utf-8 to the top of my class. I don't really know much about encoding but can someone perhaps give me an idea of what's going here? Btw, I also insured that the source html was already in utf-8. Thanks!
# encoding: utf-8won't do anything to how your class functions. It's just a comment... I think you may be confusing it with putting# -*- coding: utf-8 -*-at the top of the file, which simply tries to alert the parser (or text editor, etc) of the encoding of the source code.# encoding: utf-8and# -*- coding: utf-8 -*-have exactly the same effect. Python uses a regular expression to parse the encoding declaration; see docs.python.org/reference/…