
30 Nov
2007
30 Nov
'07
8:10 a.m.
On 30/11/2007, m h
How do I run non-ascii queries in python? Or from the command line for that matter?
Naive tests on my part fail....
Hi Matt, the following script works fine for me as can be seen in the attached screenshot. Markus --- # -*- coding: utf-8 -*- import MonetSQLdb x = MonetSQLdb.connect() c = x.cursor() c.execute('DROP TABLE test') c.execute('CREATE TABLE test(id int, name varchar(20))') c.execute('INSERT INTO test (id, name) VALUES (%s, %s)', (0, 'ä ö ü €')) c.execute('SELECT * FROM test') value = c.fetchone()[-1] print type(value) print value print unicode(value, 'utf-8').encode('windows-1252') c.close() x.close()