UnicodeDecodeError: 'ascii' codec can't decode byte

by Scott Hebert

Jinja2 logo -rightAlthough I was getting this output in relation to one of my Jinja2 templates, it really isn't a Jinja2 problem.

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 69: ordinal not in range(128)

The bit of code here should be doing nothing more than printing a float:


For whatever reason, whatever is being returned from profit_created() seems to contain a "รข" (that's an "a" with a hat). Stack Overflow indicates two solutions for this problem. I decided to go with the second solution, buried in the comments:

from __future__ import unicode_literals

If that doesn't work, the other solution seems to work just fine, too.