In MySQL I have a field with the value: "Rœschwoog"
The charset of the MySQL table is UTF-8.
When I retrieve that value from Python 3.4, I save it into a dict. When I print that dict, I realize that the value is not "Rœschwoog" but "R\x9cschwoog" instead. Why is this happening? How can I get the real value?
I create the MySQL connection with:
conn = pymysql.connect(host='127.0.0.1', user='xxx', passwd="yyy", db='mydb')
"R\x9cschwoog"is Python's representation of the stringRœschwoogencoded in thewindows-1252encoding. Can you please add the relevant parts of your code (a simplified testcase) to your question? Particularly, what connection parameters do you use when creating your MySQL connection?charset="utf8"to your connection parameters. See this answer, this one and the pymsql docs for some more details.