Forums

Mysql database utf8 problem

I have been struggling for hours and hours on end trying to store some utf8 varchars in the database, with no avail, not sure what is going on.<br> I have read and did THIS, it changed nothing, i do have <b>charset='utf8', use_unicode=True</b> in my connection to the database using mysql.connector.<br> Yes the default character set for the database is utf8 DEFAULT CHARACTER SET utf8 , yes the table collation is utf8_general_ci, yes the data i'm trying to insert is correct utf8 characters. No i'm not trying to store weird characters not present in the base utf-8.<br> I have no idea what is going on but it's been like 5 hours or more that i'm trying over and over to do store utf8 characters in the database. I'm going literally crazy. It worked 2 times, randomly, i didn't touch anything, got back to it and it wasn't working again for some reason. One time it worked by removing the charset from the connection, the other time i don't even remember. I'm not sure what should i do at this point.

the part where it sometimes works and sometimes strips characters and works and usually fails all sounds very weird.

how are you running this? eg: is this through a script on pythonanywhere consoles? or are you say doing this from within a mysql console from the db tab?

Ok, after hours and hours i found the problem, i will leave here the answer in case someone else has the same problem in the future, when storing utf8 characters the collation utf8_general_ci was the problem because it matches utf8 characters very lazily, "