[SQLObject] cannot insert unicode to mysql
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ivan H. <i.h...@al...> - 2006-08-30 12:09:14
|
Dear sqlobject-discuss, i have a big problem, because i have to insert unicode into mysql tables mysql version is 1.4.13 i have already mysql-python version 1.2.2b1 it handle unicode inserting well, for instance this code works fine: sb =3D u'=E9=E1=ED'.encode('utf-8') c.execute("insert into unit (code) values ('%s')" % sb) but when i try to insert the same thing with SQLObject the system inserts something different to the table: this is my py code connString =3D "mysql://root:pw...@ti.../vss=5Fhistory?use=5Funicode= =3D1&debug=3D1" =5F=5Fconnection=5F=5F =3D connectionForURI(connString) class Unit(SQLObject): class sqlmeta: fromDatabase=3DTrue Unit(code=3Du'=E9=E1=ED') this is the mysql table create command DROP TABLE IF EXISTS `vss=5Fhistory`.`unit`; CREATE TABLE `vss=5Fhistory`.`unit` ( `id` int(11) NOT NULL auto=5Fincrement, `code` varchar(10) default NULL, PRIMARY KEY (`id`) ) ENGINE=3DMyISAM DEFAULT CHARSET=3Dutf8; =20 please help me, because i've already spent too many time with many, many trials without success --=20 Best regards, Ivan Horvath Chief Programmer Anyone who has never made a mistake has never tried anything new. /Albert Einstein/ |