TOgakangaroo Posted January 18, 2007 Share Posted January 18, 2007 Hello, 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 querymysql($database_info, "INSERT INTO tblSomeTable VALUES 'México'");It doesn't cut off but does insert gibberishOne intersting thing that I've found is that everything works out fine when the variable is passed through the HTTP Post Methodmysql($database_info, "INSERT INTO tblSomeTable VALUES $_POST['name']");where $_POST["name"]='México' from a form imputthis 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. Link to comment https://forums.phpfreaks.com/topic/34694-storing-international-characters-through-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.