Re: [SQLObject] unicode string in queries - a bug?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Stuart B. <st...@st...> - 2006-02-09 04:36:18
|
Oleg Broytmann wrote: > On Mon, Jan 30, 2006 at 11:40:55AM +0700, Stuart Bishop wrote: > >>Oleg Broytmann wrote: >> >>> Do cls.selectBy(that_unicode_col=u'some string'.encode(dbEncoding)) >> >>We handle this quite simply by encoding the entire query before sending it >>to the database > > How do you handle different encoding? > > class Koiruski(SQLObject): > unixway = UnicodeCol(dbEncoding="koi8-r") > > class Windows(SQLObject): > mustDie = UnicodeCol(dbEncoding="cp1251") The UnicodeCol columns would need to be quoted into a valid ASCII stream. I don't think this is supported at the moment anyway (at least with the PostgreSQL backend) - if you are talking to a PostgreSQL backend you would need to ensure that the client_encoding of the connection is ASCII or else you will get an error, and this is hard coded to UTF-8. -- Stuart Bishop <st...@st...> http://www.stuartbishop.net/ |