I am using this package here: HTML.py 0.04
Here is what I am doing:
import html
h = html.HTML()
h.p('Some simple Euro: €1.14')
h.p(u'Some Euro: €1.14')
Now when I do >>> unicode(h) I get an error.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 18: ordinal not in range(128)
What is the best way to handle this? I need to write the html to a file.
u''), you can usefrom __future__ import unicode_literalsat the top of your file to automagically convert most of''tou''automatically. Personally, I'd avoid Py2 if possible, it is a mess about encoding (doing lot of conversion in your back) and can be very confusing easily. - jeromej