Im trying to use urllib2 to download a webpage and save it to a MySQL database. like this :
result_text = result.read()
result_text = result_text.decode('utf-8')
however I get this error :
Data: 'utf8' codec can't decode byte 0x88
Now, the HTML meta tag states that the encoding is indeed utf-8. Ive managed to get around this with this line :
result_text = result_text.decode('utf-8','replace')
Which replaces the bad characters. however, i'm not sure that this is not an indication that something could be wrong with the downloaded data, or that i'm removing valuable characters. IU should add that the page also contains JavaScript - although this shouldn't be a problem I believe.
Can anyone tell me why this is happening? Thanks