[SQLObject] Re: MySQL connection encoding problem
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Robert S. <rsz...@mu...> - 2006-04-27 08:27:12
|
Oleg Broytmann wrote: > On Thu, Apr 27, 2006 at 08:32:58AM +0200, Robert Szefler wrote: > >>> You can set the encoding in .my.cnf. Thus you don't need to patch >>>SQLObject. >> >>I want SQLObject's (which is a high-level interface) behavior to be >>deterministic and not dependent on site configuration. Again, if it can >>be, why won't it? Can't we just fix the f*d up behavior? > > The behavior is not f*d up. ;) The libmysql's is IMHO, I'm not (yet) complaining about SQLObject - it's still in the making after all. Depending on arbitrary host settings when you want it to just work will bite you sooner or later. Like testing on a host with encoding=utf8 in my.cnf and deploying where there's koi8-r or whatever. You don't want the my.cnf to be a part of your project's config taking into account that it might break a lot of other thigs. That's the f*d up design I talk about. The connection encoding should be hardwired for most, if not all, purposes. UTF8 is OK because it covers exactly the whole unicode range. >>>> cursor.execute('SET NAMES utf8') # ADDED > > > I don't want to put such an arbitrary constant ("utf8") into the code. > Why not "koi8-r" - that's what I use? Recoding would take care of this. You already need it when you define UnicodeCols. Second one certainly wouldn't hurt and it would give the system a well-defined behavior. I admit my "patch" is a bit of a dirty hack, but this should be solved. |