Re: [SQLObject] setting db encoding with postgresql
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2008-02-15 05:29:55
|
On Thu, Feb 14, 2008 at 06:32:06PM -0500, Max Aginaga wrote: > I am using SQLObject-0.10.0b2 on Postgresql 8.3. The database is using > UTF8 as its encoding. > > I am connecting to the db with the connectionURI > > "postgres://%s:%s@%s/%s"%(DB_USERNAME, DB_PASSWORD, DB_HOST, DB_NAME) > > The connection succeeds, but I cannot insert anything into the db: I > get an exception which ends in > > ProgrammingError: invalid byte sequence for encoding "UTF8": 0xfe > HINT: This error can also happen if the byte sequence does not match > the encoding expected by the server, which is controlled by > "client_encoding". > > The trouble is that appending "?client_encoding=utf-8" to the > connection URI generates the error This is only valid for MySQL backend. PostgreSQL backend in SQLObject doesn't know anything about encodings. I use PostgreSQL, and all my databases are in UTF-8, but I never was in need to set client_encoding. I use UnicodeCol()umns with default UTF-8 encoding, and they pass data to and fro Pg in utf-8, no problem so far. Locale at the client part is koi8-r or windows-1251. If UnicodeCol() don't help, it would be helpful to see a small test program that demonstrates the problem. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |