[egenix-users] UTF-8 problem

Martin Winkler mw at agami.at
Thu Jun 16 20:14:12 CEST 2005


On Wed, 2005-06-08 at 19:31 +0200, Charlie Clark wrote:
> 
> But that isn't quite the same thing which is why I suggest you try the 
> statements at the Python level.

Ok, just did that:

import mx.ODBC.iODBC
db = mx.ODBC.iODBC.DriverConnect('DSN=User;UID=;PWD=')
c = db.cursor()

c.execute("select name1 from persons where id = 33")
res = c.fetchall()
print r[0][0]

brings the umlauts as usual.

but:

c.execute("update projects set title='täst 80a' where id = 80")
c.execute("select title from projects where id = 80")
print r[0][0]

gives me the double-encoded utf-8 characters. ("täst 80a")


The environment of the server is:
LANG=en_US.UTF-8
SUPPORTED=en_US.UTF-8:en_US:en:de_DE.UTF-8:de_DE:de

Zope really is not the problem here...

> .encoding 
> Read/write attribute which defines the encoding to use for converting 
> Unicode to 8-bit strings and vice-versa. If set to None (default), Python's 
> default encoding will be used, otherwise it has to be a string providing a 
> valid encoding name, e.g. 'latin-1' or 'utf-8'.  

I also tried 
db.encoding='utf-8'
and
db.encoding='latin-1'

directly after the db=... statement, but that changed nothing :-(


Help....? :,-(

br,
Martin




More information about the egenix-users mailing list