471,330 Members | 1,048 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

sqlite3.OperationalError: Could not decode to UTF-8 column

Hi

I'm trying to use sqlite with python 2.5 but I have this problem:

Traceback (most recent call last):
File "converter.py", line 13, in <module>
c_old.execute('select id_aluno, nome from aluno')
sqlite3.OperationalError: Could not decode to UTF-8 column 'nome' with
text 'Ana Margarida Fernandes Gonçalves de Sá'

The database was created with another program and all data is in
database is in latin1.

Thanks,
Filipe Sousa
Sep 5 '07 #1
2 16230
On Wed, 2007-09-05 at 16:40 +0100, Filipe Sousa wrote:
Hi

I'm trying to use sqlite with python 2.5 but I have this problem:

Traceback (most recent call last):
File "converter.py", line 13, in <module>
c_old.execute('select id_aluno, nome from aluno')
sqlite3.OperationalError: Could not decode to UTF-8 column 'nome' with
text 'Ana Margarida Fernandes Gonçalves de Sá'

The database was created with another program and all data is in
database is in latin1.
Try setting

conn.text_factory = str

where conn is the name of your sqlite3 connection object. See
http://docs.python.org/lib/sqlite3-C...n-Objects.html for more
information.

HTH,

--
Carsten Haese
http://informixdb.sourceforge.net
Sep 5 '07 #2
Carsten Haese wrote:
On Wed, 2007-09-05 at 16:40 +0100, Filipe Sousa wrote:

Try setting

conn.text_factory = str

where conn is the name of your sqlite3 connection object. See
http://docs.python.org/lib/sqlite3-C...n-Objects.html for more
information.

HTH,
Thanks!
It works :)
Sep 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by David Pratt | last post: by
38 posts views Thread by John Salerno | last post: by
2 posts views Thread by Josh | last post: by
3 posts views Thread by cjl | last post: by
1 post views Thread by Suwayya | last post: by
1 post views Thread by anonymous | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.