Setting the encoding in pysqlite2

"Martin v. Löwis" martin at v.loewis.de
Fri Aug 26 04:12:15 EDT 2005


Michele Simionato wrote:
> Well, the issue is not how to input text in the database from Python
> (it is enough to use literal unicode strings);
> in my case the database has been generated from a text file containing
> accented chars, using .import,
> and it seems I cannot read it from Python because of the unicode error
> :-(

You should not do that. In SQLite 3, TEXT fields should always be
UTF-8. That .import did not reject your data sounds like a bug in
.import.

So if you make your input data UTF-8, you should be able to fetch
them easily, and receive Unicode strings.

Regards,
Martin



More information about the Python-list mailing list