Re: [pysqlite] more Unicode grief
Gerhard Häring <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Eric S. Johansson wrote: > I'm really not sure what to do. I've installed the latest pysqlite and sqlite, > verified that the text_factory attribute is Unicode, verify that I am stuffing > unique code into my records and still, it gives me errors like: > > OperationalError: Could not decode to UTF-8 column 'message_id' with text > '<20070323191203.4937.qmail@С²Ì>' > > I am puzzled. The way I read the documentation, I should be getting Unicode > back all the time from pysqlite. Why does it appear that pysqlite is trying to > convert to utf-8? The SQLite API returns UTF-8 encoded C strings. In order to produce Unicode objects, pysqlite has to do the Python C-API equivalent of calling unicode(..., "utf-8") So, the problem is still that you've got non UTF-8 data in your database. I'll change pysqlite in the next release so that it will be impossible to create such scenarios at least by using pysqlite to enter data. - -- Gerhard -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFH5kkWdIO4ozGCH14RAtWQAJ0aWKnsDzRipbWo3EoNxBT126F4lQCcDhth 6ej7cjY/Vvk89+nfsYpp0MY= =OgTp -----END PGP SIGNATURE-----