Using utf-8 characters in a Jinja2 template
TL;DR: Pass Unicode to template.render() Encode the rendered unicode result to a bytestring before writing it to a file This had me puzzled for a while. Because you do index_file.write( template.render(index_variables) ) in one statement, that’s basically just one line where Python is concerned, so the traceback you get is misleading: The exception I got … Read more