UnicodeDecodeError: 'ascii' codec can't decode byte

Gilles Ganault nospam at nospam.com
Tue Jun 17 17:09:30 EDT 2008


On Tue, 17 Jun 2008 09:23:28 +0200, Peter Otten <__peter__ at web.de>
wrote:
> Assuming that encoding is UTF-8 and that apsw can cope
> with unicode, try to convert your data to unicode before
> feeding it to the database api:
>
>> sql = "INSERT INTO mytable (col1,col2) VALUES (?,?)"
>
>  rows = ([col.decode("utf-8") for col in row] for row in
>records("test.tsv")) 
>  cursor.executemany(sql, rows)

Thanks again.



More information about the Python-list mailing list