Dear Sophana,

please write your questions to sqlobject mailing list. unfortunatelly i don't 
have experience on linux machines, i'm working on windows.

but, the problem of the query is just syntactical:
Unit._connection.query("SET NAMES utf8")

as you can see i specify the client encoding in the connection string:
connString = "mysql://root:[EMAIL 
PROTECTED]/vss_history?use_unicode=1&client_encoding=utf8"

then to insert:
Unit(code=u'éá')


*********** REPLY SEPARATOR  ***********

On 11/09/2006 at 18:08 sophana wrote:

>Hi
>I also have an unicode problem.
>SQLObject 7.1
>
>class Test(SQLObject):
>    val=UnicodeCol(dbEncoding='UTF8')
>Test._connection.query("SET NAMES utf-8")
>
>gives me an error:
>  File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line
>33, in defaulterrorhandler
>    raise errorclass, errorvalue
>_mysql_exceptions.ProgrammingError: (1064, "You have an error in your
>SQL syntax near 'NAMES utf-8' at line 1")
>
>Can't get unicode to work...
>
>>>> Test(val=u'été'.encode('UTF8'))
>
>gives:
>  File
>"/usr/lib/python2.4/site-packages/SQLObject-0.7.1rc1-py2.4.egg/sqlobject/dbconnection.py",
>line 221, in _runWithConnection
>    val = meth(conn, *args)
>  File
>"/usr/lib/python2.4/site-packages/SQLObject-0.7.1rc1-py2.4.egg/sqlobject/mysql/mysqlconnection.py",
>line 94, in _queryInsertID
>    self._executeRetry(conn, c, q)
>  File
>"/usr/lib/python2.4/site-packages/SQLObject-0.7.1rc1-py2.4.egg/sqlobject/mysql/mysqlconnection.py",
>line 73, in _executeRetry
>    myquery = unicode(query, self.encoding)
>UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 32:
>ordinal not in range(128)
>
>Thanks for your help.
>Sophana
>
>Ivan Horvath a écrit :
>> Dear Oleg,
>>
>>      thank you very much !!!!
>>      the set names utf8 query helped
>>
>>      then i've figured out if i use client_encoding parameter in
>>      connection string the insert is also OK.
>>
>>      so, thank you again.
>>
>> Wednesday, August 30, 2006, 4:15:33 PM, you wrote:
>>
>> OB> It's hard to see iso8859-15 on a koi8-r terminal. :( Let's go
>guessing and
>> OB> experimenting.
>> OB>    Do you have any local or global my.cnf that sets an encoding? Does
>> OB> Unit(code=u'test') work? Does Unit._connection.query("SET NAMES
>utf-8")
>> OB> help?
>>
>> OB> Oleg.
>>
>>
>>
>>


Best regards, 
    Ivan Horvath 
    Chief Programmer 
 
 Alcatel ISD 
 PMS 2000 Product Team 
 
 H-1116, Budapest 
 Kondorfa u. 10. 
 Tel.: +36 1 209 9546 
 Fax.: +36 1 209 9599 
 Mobil: +36 30 257 0235 
 VOIP: +49 511 676 478010 
 [EMAIL PROTECTED] 

Anyone who has never made a mistake has never tried anything new. 

/Albert Einstein/ 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to