[ZPT] Working with encoded values in more recent versions of ZPT

Charlie Clark charlie at egenix.com
Mon Aug 20 08:41:30 EDT 2007


Hi,

I've noticed in Zope 2.10 that the behaviour of ZPT with regard to encoded  
values returned by a database has changed which leads to errors when using  
string: and non-ascii characters.

ie.

<tal:content tal:content="string: ${result/firstname} ${result/surname}"  
/> will raise UnicodeDecodeError
for result = {'firstname':'charlie', 'surname':'Düsseldorf'}
but not if Python string formatting is used
<tal:content tal:content="python: '%s %s' % (result['firstname'],  
result['surname'])" />

Is this the only workaround apart from decoding all return values?

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

     eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
            Registered at Amtsgericht Duesseldorf: HRB 46611


More information about the ZPT mailing list