Posted this in the databases forum but in retrospect the MySQL might just be a symptom of some setting in PHP being wrong:
I am working on a large project which involves among other things storing names with international characters in MySQL tables. This data is typically delivered via spreadsheets so I have written a utility to do upload a file and do just that. I am running into the problem currently that certain characters (i.e. the spanish e with an accent) will not import correctly causing the rest of the name to be cut off.
So for example, running
$term = 'México';
mysql($database_info, "INSERT INTO tblSomeTable VALUES $term");
will store only 'M'.
If I hardwire the term into the query
mysql($database_info, "INSERT INTO tblSomeTable VALUES 'México'");
It doesn't cut off but does insert gibberish
One intersting thing that I've found is that everything works out fine when the variable is passed through the HTTP Post Method
mysql($database_info, "INSERT INTO tblSomeTable VALUES $POST['name']");
where $POST["name"]='México' from a form imput
this inserts correctly.
My intuition is that I need to set PHP to use the same encoding that HTTP POST uses but I don't know if that's true nor exactly how to do that. Has anybody run into this problem before/can help me out?
Thanks a lot for your help.