[egenix-users] Unicode problems with mxODBCZopeDA-1.0.10

Jose Rivera Merla jriveramerla at gmail.com
Thu Nov 29 09:43:44 CET 2007


*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 ú.

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.

Regards,
Jose

On Nov 27, 2007 1:11 PM, eGenix Support: Charlie Clark <support at egenix.com>
wrote:

> 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
>



-- 
Jose Rivera Merla
Vivir Con Intensidad Cada Instante, ¿Que Otra Cosa Desear?
Blog: http://unregiosonador.blogspot.com/index.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman-archives/egenix-users/attachments/20071129/159dee1f/attachment.htm


More information about the egenix-users mailing list