Could you share the exact traceback?
Looking very quickly at the Mako documentation it expects unicode and
should deal with it well so you must be sending it bytes instead of
unicode at some stage, see the traceback below.
>>> unicode_filename = u'file\u2014name'
>>> bytes_filename = unicode_filename.encode('utf-8')
>>> print Template("filename : ${filename}").render(filename=unicode_filename)
filename : file—name
>>> print Template("filename : ${filename}").render(filename=bytes_filename)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/eugene/Envs/mako/lib/python2.7/site-packages/mako/template.py",
line 397, in render
return runtime._render(self, self.callable_, args, data)
File "/Users/eugene/Envs/mako/lib/python2.7/site-packages/mako/runtime.py",
line 764, in _render
**_kwargs_for_callable(callable_, data))
File "/Users/eugene/Envs/mako/lib/python2.7/site-packages/mako/runtime.py",
line 796, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/Users/eugene/Envs/mako/lib/python2.7/site-packages/mako/runtime.py",
line 822, in _exec_template
callable_(context, *args, **kwargs)
File "memory:0x1007700d0", line 22, in render_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
4: ordinal not in range(128)
It is very important to know what is the encoding used in your application.
Cheers,