PySqlite client_encoding, stores fine but queries don't return unicode

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Mon Dec 1 15:06:52 EST 2003


Hello
I'm having some troubles with PySqlite (0.4.3, windows/linux).

I want to store unicode strings in the database.
So I open a connection with the client_encoding="UTF-8" parameter.
When I store a unicode string in a table, it seems to work fine.
(a sqlite .dump shows that it encoded the unicode string to UTF-8).

But the problem is that a *query* from the same table, doesn't
return the string contents as a unicode string! Rather, it
returns a normal string that still contains the UTF-8 encoded
bytes...

Is there any way to make pysqlite decode the UTF-8 strings
and return unicode strings automatically ?

Thanks!

-Irmen de Jong





More information about the Python-list mailing list