Python PayPal IPN import MYSQL Euro Characters Fail

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Python PayPal IPN import MYSQL Euro Characters Fail



I have a python3 to work as a PayPal IPN Receiver. So far it's okay, but when there are some European Characters are not success to insert into MYSQL Table.



For Example:
Skořepová insert into MYSQL table will become Sko?epová



The IPN Message is something like this:


address_name=Cool+Sko%C5%99epov%C3%A1&address_state=Jind%C5%99ich%C5%AFv+Hradec



Below is my code:


def index(self, **data):
db = mysql.connector.connect(host="xxxxxxxx",user="xxxxxx",passwd="xxxxxx",db="xxxx",charset="utf8")
cursor = db.cursor(buffered=True)
for k,v in data.items():
print(k,v)
cursor.execute(u"INSERT INTO tablename VALUES(NULL,%s,%s)",(k,v))



The print result is "Cool Skořepová"
But MYSQL is "Cool Sko?epová"
Yes, the á is no problem to insert, but some characters such as this ř is not.



And I have tried to insert directly:


v="Skořepová"
cursor.execute("INSERT INTO tblTmpCreatePASCL VALUES(NULL,'" + v + "')")



The result is also no problem to display "Skořepová" in MYSQL Table



Can anyone help me find out the problem? Thank you.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results