Working with encoded values in more recent versions of ZPT
"Charlie Clark" <[email protected]> Mon, 20 Aug 2007 14:41:30 +0200
| Newsgroups | gmane.comp.web.zope.page-templates |
|---|---|
| Organization | eGenix.com |
| Message-ID | <[email protected]> |
Hi,
I've noticed in Zope 2.10 that the behaviour of ZPT with regard to encode=
d =20
values returned by a database has changed which leads to errors when usin=
g =20
string: and non-ascii characters.
ie.
<tal:content tal:content=3D"string: ${result/firstname} ${result/surname}=
" =20
/> will raise UnicodeDecodeError
for result =3D {'firstname':'charlie', 'surname':'D=C3=BCsseldorf'}
but not if Python string formatting is used
<tal:content tal:content=3D"python: '%s %s' % (result['firstname'], =20
result['surname'])" />
Is this the only workaround apart from decoding all return values?
Charlie
--=20
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