From: Armin Ronacher Date: Fri, 6 Jun 2014 15:30:53 +0000 (+0600) Subject: Fixed issue #309 X-Git-Tag: 2.8~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7086dbdb81c45dd43cc83270c827ddd2c6ed59b;p=thirdparty%2Fjinja.git Fixed issue #309 --- diff --git a/jinja2/environment.py b/jinja2/environment.py index f56bd456..326a5792 100644 --- a/jinja2/environment.py +++ b/jinja2/environment.py @@ -1140,7 +1140,9 @@ class TemplateStream(object): """ close = False if isinstance(fp, string_types): - fp = open(fp, encoding is None and 'w' or 'wb') + if encoding is None: + encoding = 'utf-8' + fp = open(fp, 'wb') close = True try: if encoding is not None: