cursor.execute('SELECT userid,productid,description from goqii_store_product_rating_log')
Above is the query I am trying to read from MySQL database using python.
Here the Datatype for description column is TEXT.
When I run this I get the following error:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 8: character maps to
How can I overcome this error and read the data smoothly??.
Python Version used : 3.7.3
Regards
I think the question has already been answered here:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 7240: character maps to <undefined>
This seems to be an issue that has been caused by encoding differences.
A way to work around this has been pointed out here as well. Hope this helps: How to return str from MySQL using mysql.connector?
Also, you need to provide more details while posting the question such as the connector you used (eg: PyMySQL)
Try something on these lines:
conn = pymysql.connect(host='localhost',
user='username',
passwd='password',
db='database',
charset='utf8')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With