Re: [pysqlite] Trouble with create_function interface to sqlite
Roger Binns <[email protected]> Thu, 29 May 2008 00:49:49 -0700
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Raul Garcia Garcia wrote: > I've got a SQLite3 database which have strings encoded in iso-8859-1 rather > than in utf8. Just for the record this is spectacularly bad idea. SQLite 3 code is built with the premise that all strings are unicode (not utf8). There are utf16 and utf8 apis that will produce the appropriate representation as needed. You only manage to get away with having iso-8859-1 "strings" because pysqlite happens to be using the utf8 apis, the underlying file representation is utf8 and most importantly because the SQLite api does not check that strings you claim to be providing in utf8 are in fact valid utf8. If this last bit ever changes then trying to use non-unicode string data will be prevented. If someone else is generating these arguably invalid files then you'll want to help get things right. This article usually helps understanding: http://joelonsoftware.com/articles/Unicode.html Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFIPmAdmOOfHg372QQRAtNjAJwJ8BP+rTFA2zbnvAWssb14MH2ncACeMh/Y N4fG3ZSCTI+R2z7wXXxcS+I= =nn/+ -----END PGP SIGNATURE-----