make use of codecs.open when rendering from templates