Python 2.4 vs 2.5 - Unicode error

Gaurav Veda vedagaurav at gmail.com
Wed Jan 21 12:49:08 EST 2009


Hi,

I am trying to put some webpages into a mysql database using python
(after some processing on the text). If I use Python 2.4.2, it works
without a fuss. However, on Python 2.5, I get the following error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
4357: ordinal not in range(128)

Before sending the (insert) query to the mysql server, I do the
following which I think should've taken care of this problem:
 sqlStr = sqlStr.replace('\\', '\\\\')

(where sqlStr is the query).

Any suggestions?

Thanks!
Gaurav



More information about the Python-list mailing list