Python 2.4 vs 2.5 - Unicode error

Gaurav Veda vedagaurav at
Wed Jan 21 18:49:08 CET 2009


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?


More information about the Python-list mailing list