Re: troubles with unicode

Petr Jakeš <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <CAERU-Va3GWSRXRK66PXvAz=14V86kAasS8S0ZEXKpJXaDfg6WQ@mail.gmail.com>
> It seems your DB API adapter (kinterbasedb) returned unicode values.
> StringCol tried to encode them to strings in dbEncoding (ascii) and
> failed. Perhaps you have to set a proper dbEncoding. SQLObject 1.1 can
> set one encoding per table or per connection.
>
>
Hmmm... the unicode type string comes from the TurboGears web form actually.
Now I am encoding it to the utf-8 str type when it comes from the web form
but the Error occurs as before

  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/firebird/firebirdconnection.py",
line 105, in _queryInsertID
    q = self._insertSQL(table, names, values)
  File
"/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py",
line 387, in _insertSQL
    ', '.join([self.sqlrepr(v) for v in values])))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16:
ordinal not in range(128)

I made the change in the sqlobject.dburi from
sqlobject.dburi="firebird://user:password@localhost
:3050/pathToTheDatabase/automaty.fdb"
to
sqlobject.dburi="firebird://user:password@localhost
:3050/pathToTheDatabase/automaty.fdb?charset=utf8"

but nothing changed.

I made the change in the table column definition. Because I am using
"fromDatabase = True" for all tables,  I added the manual definition of the
column in the table definition:
poznamka = UnicodeCol(dbEncoding = "utf8")

but nothing changed.

Do you have any idea how to force SQLObject to use the utf-8 instead of
"ascii" for decoding?

Petr

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/

_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.