Posts

Showing posts with the label character-encoding

Python PayPal IPN import MYSQL Euro Characters Fail

Image
Clash 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 di...