[egenix-users] Unicode problems with mxODBCZopeDA-1.0.10

Jose Rivera Merla jriveramerla at gmail.com
Tue Nov 27 09:14:22 CET 2007


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

*SELECT
    Espacio_Id,
    Espacio,
    Specs,
    isnull(POP,'.') Pop
FROM CatalogoDeEspacios
*
and it displays:*

  XX a���� A�E�I�O�U�n�

*instead of:*

  XX aá eé ií oó uú AÁ EÉ IÍ OÓ UÚ nñ NÑ

*Regards,
Jose*

On Nov 27, 2007 8:54 AM, Jose Rivera Merla <jriveramerla at gmail.com> wrote:

> *Hi, here it is the info requested,
>
> DB: *MS SQL Server 2000
> *Table:*CatalogoDeEspacios
> *4 Fields:*
> espacio_id    int    no    4    10       0        no    (n/a)    (n/a)
> NULL
> *espacio *    nvarchar    no    510                      yes    (n/a)
> (n/a)    SQL_Latin1_General_CP1_CI_AS
> specs    nvarchar    no    510                      yes    (n/a)
> (n/a)    SQL_Latin1_General_CP1_CI_AS
> POP    nvarchar    no    510                      yes    (n/a)    (n/a)
> SQL_Latin1_General_CP1_CI_AS
>
> *I have the problems with the column espacio.
>
> And I return the data with a SQL Method, and when I found the poblem
> started makeing tests with a python script, and thats why I detected that
> specifing it as unicode (u'string') solved the problem, but can this be done
> somewhere else so I don't have to do it for each column of characters?
>
> Regards,
> Jose
> *
>
> On Nov 27, 2007 6:35 AM, M.-A. Lemburg <mal at egenix.com> wrote:
>
> > On 2007-11-27 01:30, Jose Rivera Merla wrote:
> > > *I am having problems displaying spanish accents like á,é,í,ó and ú.
> > >
> > > My setup is:*
> > >
> > >    - Plone 3.0.3
> > >    - CMF-2.1.0
> > >    - Zope (Zope 2.10.5-final, python 2.4.4, win32)
> > >    - Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit
> > >    (Intel)]
> > >    - PIL 1.1.6
> > >
> > > *and mxodbc:*
> > > mxODBCZopeDA (Installed product mxODBCZopeDA
> > > (mxODBCZopeDA-1.0.10))<
> > http://fctcmty01:8080/Control_Panel/Products/mxODBCZopeDA/manage_workspace>
> >
> > >
> > >
> > > *With the following string returned from a database I get a problem:*
> > >
> > > 'XX a\xe1 e\xe9 i\xed o\xf3 u\xfa A\xc1 E\xc9 I\xcd O\xd3 U\xda n\xf1
> > N\xd1'
> > >
> > > *When I try to display it it doesn't  display correctly, I made an
> > > experiment with the same value in a python script and it worked after
> > I
> > > returned the following script*
> > >
> > > u'XX a\xe1 e\xe9 i\xed o\xf3 u\xfa A\xc1 E\xc9 I\xcd O\xd3 U\xda n\xf1
> >
> > > N\xd1'
> > >
> > > *instead of just*
> > >
> > > 'XX a\xe1 e\xe9 i\xed o\xf3 u\xfa A\xc1 E\xc9 I\xcd O\xd3 U\xda n\xf1
> > N\xd1'
> > >
> > > *How can I make it work?
> >
> > Could you tell us how you are reading the above string, e.g.
> > which column data type does the table have, are you using
> > Z SQL Methods to access the data, etc. ?
> >
> > Also: which database are you using and how exactly does the string
> > show up in the browser ?
> >
> > The data in your string appears to be Latin-1 encoded. Prepending
> > the "u" modifier to the string will have Python interpret it
> > as Unicode literal and thus have Zope convert the data to whatever
> > the page you're inserting the string into uses as encoding.
> >
> > If you try to insert the string as-is into, say, a UTF-8 encoded
> > page, then the browser will have problems displaying the mixture
> > of Latin-1 and UTF-8 data.
> >
> > In such a case, you have to explicitly convert the string data
> > into UTF-8 before inserting it into the page.
> >
> > Regards,
> > --
> > Marc-Andre Lemburg
> > eGenix.com
> >
> > Professional Python Services directly from the Source  (#1, Nov 27 2007)
> > >>> 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




-- 
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/20071127/27c1844b/attachment.htm


More information about the egenix-users mailing list