Permalink
Browse files

Fix issue with

    UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

when rendering template within non-ASCII strings (non-unicodes)
  • Loading branch information...
1 parent 21a2010 commit 17af9b5a9d5a77c1f0c1ec296bfaa6220cb62876 @vintozver committed Oct 3, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 jinja2/_markupsafe/_native.py
@@ -40,6 +40,8 @@ def soft_unicode(s):
"""Make a string unicode if it isn't already. That way a markup
string is not converted back to unicode.
"""
+ if isinstance(s, str):
+ s = s.decode('utf-8')
if not isinstance(s, unicode):
s = unicode(s)
return s

0 comments on commit 17af9b5

Please sign in to comment.