Fwd: Re: [Zope] Re: problem with input elements and unicode/utf-8
--- In zope@yahoogroups.com, Andreas Jung <lists@...> wrote: --On 20. Februar 2007 18:52:51 +0100 Andreas Jung <lists@...> wrote:
--On 20. Februar 2007 17:52:52 +0100 Andreas Jung <lists@...> wrote:
--On 19. Februar 2007 12:29:34 -0800 Jostein Leira <jleira@...> wrote:
If it contains either of the tal-lines below I get the following error message: <div tal:content="python:unicode('hei på deg','utf8')" />
This patch works better:
Index: ZRPythonExpr.py =================================================================== --- ZRPythonExpr.py (revision 72721) +++ ZRPythonExpr.py (working copy) @@ -29,7 +29,9 @@
def __init__(self, name, expr, engine): self.text = text = expr.strip().replace('\n', ' ') - code, err, warn, use = compile_restricted_eval(text, str (self)) + if isinstance(text, unicode): + text = text.encode('utf-8') + code, err, warn, use = compile_restricted_eval(text, self.__class__.__name__) if err: raise engine.getCompilerError()('Python expression error:\n%s' % '\n'.join(err))
-aj
This was a very welcome fix that I think many will appreciate. It did fix my problem. Regards Jost
participants (1)
-
jleira