[egenix-users] Unicode problems with mxODBCZopeDA-1.0.10
eGenix Support: Charlie Clark
support at egenix.com
Tue Nov 27 20:11:53 CET 2007
Am 27.11.2007, 16:14 Uhr, schrieb Jose Rivera Merla
<jriveramerla at gmail.com>:
> *I forgot to include that I display the string with
> * <td class="Report"
> tal:content="result/ESPACIO">Espacio</td>
> *where result comes from the Z SQL Method with the SQL command :
Hi Jose,
looking at that line it looks like you're hitting a bug in Zope 2.10's
PageTemplates which should have been fixed in the 10.5 release - I don't
know which Plone 3.0.3 is using.
From experience there are two quick solutions: either explicitly decode
your values using the .decode() method of your string objects:
<td class="Report" tal:content="python:
result['ESPACIO'].decode('latin-1')">Espacio</td>
As this is a bit clumsy in a template you can use CMFDefault.utils.decode
in a controlling script and everything correctly decoded.
from Products.CMFDefault import decode
options = {}
options['results'] = results # ZSQL call
return context.template_to_be_used(**decode(options))
This approach is preferable if you have lots of content that might need
decoding
or perhaps easier: use a string expression:
<td class="Report" tal:content="string:${result/ESPACIO}">Espacio</td>
Let us know how you get on.
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 egenix-users
mailing list