T
tyoc
here is the snips that can reproduce my problem in the system Im
working http://tyoc.nonlogic.org/darcsrepos/snip1.zip it is 2 files a
sample db with 1 row and a py with 1 function for read that row
The output I get is the following:
--------------------------------------------------
Traceback (most recent call last):
File "C:\Documents and Settings\dortiz\Escritorio\x\snip1.py", line
14, in <module>
l = CargaRegs(basededatos, "identificadores")
File "C:\Documents and Settings\dortiz\Escritorio\x\snip1.py", line
6, in CargaRegs
db_curs.execute("SELECT * FROM " + tabla)
OperationalError: Could not decode to UTF-8 column 't' with text 'some
texto--------------- años'
I dont understand exactly (thought I know is a decode error) but I
have created the dabatabse with python reading a CSV file that
apparently have encoding ANSI or CP1252 because the "ñ" is stored as
0xF1.
The problem like I understand is that python try to decode it like if
it where UTF8 (if the database contain ASCII chars only, this work
just great, but with other chars like "ñ" this doesnt work).
Like you see the problem come when I do db_curs.fetchall() thus I dont
know how to fetchall without this problem.
The database is not corrupt, I mean Im sure if I do a C program for
read and print the row, it will get it and just printit and not fail
like this, also you can open the DB directly with sqlite3 and
just .dump and it work at less it can fetch the row without fail (even
that in the depending on the console ir will or not print the correct
character).
working http://tyoc.nonlogic.org/darcsrepos/snip1.zip it is 2 files a
sample db with 1 row and a py with 1 function for read that row
The output I get is the following:
--------------------------------------------------
Traceback (most recent call last):
File "C:\Documents and Settings\dortiz\Escritorio\x\snip1.py", line
14, in <module>
l = CargaRegs(basededatos, "identificadores")
File "C:\Documents and Settings\dortiz\Escritorio\x\snip1.py", line
6, in CargaRegs
db_curs.execute("SELECT * FROM " + tabla)
OperationalError: Could not decode to UTF-8 column 't' with text 'some
texto--------------- años'
I dont understand exactly (thought I know is a decode error) but I
have created the dabatabse with python reading a CSV file that
apparently have encoding ANSI or CP1252 because the "ñ" is stored as
0xF1.
The problem like I understand is that python try to decode it like if
it where UTF8 (if the database contain ASCII chars only, this work
just great, but with other chars like "ñ" this doesnt work).
Like you see the problem come when I do db_curs.fetchall() thus I dont
know how to fetchall without this problem.
The database is not corrupt, I mean Im sure if I do a C program for
read and print the row, it will get it and just printit and not fail
like this, also you can open the DB directly with sqlite3 and
just .dump and it work at less it can fetch the row without fail (even
that in the depending on the console ir will or not print the correct
character).