Handle unicode exception in jinja templates