KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I constantly get this error using mako: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 6: ordinal not in range(128) I've told mako I'm using unicode in any possible way: mylookup = TemplateLookup( directories=['plugins/stl/templates'], input_encoding='utf-8', output_encoding='utf-8', default_filters=['decode.utf8'], encoding_errors='replace') self.template = Template(self.getTemplate(), lookup=mylookup, module_directory=tempfile.gettempdir(), input_encoding='utf-8', output_encoding='utf-8', default_filters=['decode.utf8'], encoding_errors='replace') html = self.template.render_unicode(data=self.stuff) All my template files starts with: ## -*- coding: utf-8 -*- and, inside them, all costant strings are prefixed with "u". I know the self.stuff parameter contains unicode strings, but the way I instantiate the mako objects should take care of it (otherwise what those arguments are good for?). Is there anything I forgot to do? One more question: what's the point of encoding_errors='replace'? =EDIT= I left only a single unicode string and this is the traceback: Traceback (most recent call last): File "C:\My Dropbox\src\flucso\src\plugins\stl\main.py", line 240, in updateView flags=self.makoflags) File "C:\Python26\lib\site-packages\mako-0.3.4-py2.6.egg\mako\template.py", line 198, in render_unicode as_unicode=True) File "C:\Python26\lib\site-packages\mako-0.3.4-py2.6.egg\mako\runtime.py", line 403, in _render _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data)) File "C:\Python26\lib\site-packages\mako-0.3.4-py2.6.egg\mako\runtime.py", line 434, in _render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File "C:\Python26\lib\site
Tags (comma-separated)
Save Edits
Cancel