UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 537: ordinal not in range(128), referer: ...
I always get this error when I try to output my whole website with characters "č". I am using mako templating. What to do?
The error occurs because somewhere code coerces your unicode template string into a python 2 str
; you need to encode the rendered template into an UTF-8 bytestring yourself:
if isinstance(rendered, unicode):
rendered = rendered.encode('UTF-8')
# rendered is now guaranteed to be of type str