[Zope-DB] Unicode charset problems dealing with the ZmySQLDA product

Dieter Maurer dieter at handshake.de
Mon Apr 30 12:30:12 EDT 2007


Miguel Sánchez Beato wrote at 2007-4-30 12:33 +0200:
>I'm having problems when I retrieve data from the database because the 
>data is not rendered using the unicode charset when the zope instance is 
>in a vserver (with a Gentoo Linux distribution), so I get  weird 
>characters like 'á' instead of the usual ones: 'á' (as they are strored 
>inthe db).

Strictly speaking, there is no "Unicode charset".

Apparently something in your data flow uses the "utf-8" charset
but your pages do not tell this to the browser.

You may try to set an
"response.setHeader('Content-Type', 'text/html; charset=utf-8)".

> ...
>Which differences are between the _mysql python module and the MySQLdb 
>library for this purpose?
>Could it be the configuation of the vserver? How can it be relationed 
>with the unicode problems?

Often the database configuration or some environment variable
determine the so called client encoding. The client encoding
controls which encoding (aka "charset") the client expects for
unicode strings.

There may be differences between your two configurations.



-- 
Dieter


More information about the Zope-DB mailing list