Le 28/10/2011 04:04, Joe Abbate a écrit :
I have an issue with converting an app from Mako to Jinja. If I have a
piece of Unicode text with, for example, an acute accented é (U+00E9), I
can verify the data is of type unicode (it's coming from a database) and
the string is printed as \xe9. However, when I pass it to
Template.render, the é is output as \xe9, i.e, not converted to utf-8.
Hi,
The important part of u'No lo s\xe9' is not that é is printed as \xe9,
but the u prefix: Template.render() return an object of type unicode, as
documented. There is no output_encoding parameter. If you want bytes you
need to call .encode() yourself, as you did in your last code sample.
The UTF-8 default is only for the file system loader.
http://jinja.pocoo.org/docs/api/#unicode
http://jinja.pocoo.org/docs/api/#jinja2.Template.render
http://jinja.pocoo.org/docs/api/#jinja2.FileSystemLoader
Regards,
--
Simon Sapin
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en.