[egenix-users] Unicode problems with mxODBCZopeDA-1.0.10
eGenix Support: Charlie Clark
support at egenix.com
Fri Nov 30 12:27:36 CET 2007
Am 29.11.2007, 16:43 Uhr, schrieb Jose Rivera Merla
<jriveramerla at gmail.com>:
> *I solved the problem of display data with the following scheme:*
> DB Connection -> ZSQL Method -> Python Script -> Page Template
> In the Page Template I display data that comes from the python script.
> Inside the python script I used the decode('latin-1') for the varchar
> fields.
> *I now have the same problem but in reverse order, in a capture to change
> information the UPDATE command insert extrange characters instead of
> á,é,i,ó, or ú.
> request.NombreDeCampo.encode('latin-1') does not work
This won't work directly in an SQL method because these only accept
operations on DTML variables I think the syntax is something like
<dtml-var NombreDeCampo.encode('latin-1')> but it could be more exotic.
Anyway this would leave you wide open to SQL injection.
Much better to pass the form into a script, do your encoding and call the
SQL method from the script passing the variables via <dtml-sqlvar>.
Alternatively with mxODBC you can pass everything to an ExternalMethod
where you won't need to worry about encoding.
> What do I need to do in this case?
*
> I find this annoying, I hope this get solved soon in the next releases of
> zope used by plone.
Highly unlikely I think. But the next release of the mxODBC Zope DA will
allow you set encoding and charsets directly on Zope DA connections.
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