Re: [pysqlite] [APSW] Reading non-UTF8 data?

Roger Binns <[email protected]> Thu, 04 Dec 2008 03:54:34 -0800
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fred wrote:
> Is there a way to tell APSW to use a different code page to read data?

SQLite stores text as Unicode only so you should never have this
problem.  When using the SQLite APIs, SQLite does expect the caller to
ensure that utf-8 encoded strings supplied are in fact valid utf-8.
APSW always ensures that data going in is valid UTF-8/Unicode.  Sadly
other wrappers do not so, you can end up with invalid Unicode.

You can work around this by casting to blob:

  select cast(code as blob), cast(label as blob) from mytable

http://www.joelonsoftware.com/articles/Unicode.html

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkk3xPEACgkQmOOfHg372QTBQACfX+r0LJ57e4o60Rprz55g7fIp
Oe0AoInM7I39cmDv5rcdLjFaOoAOBH0+
=gnnB
-----END PGP SIGNATURE-----