Hi, I have a text file, the content has some UTF-8 characters, and when I try to record it to a database (mysql) it doesn't record the UTF-8 characters, so I'm trying just to filter them to delete them all. Is there anyone who can help me? Both options are fine, find the way to record the string with UTF-8 characters or just filter and delete them all. I have the connection strings mysql_query("SET character_set_client=utf8"); mysql_query("SET character_set_connection=utf8"); mysql_query("SET character_set_results=utf8"); I read the file with a simple $filecont = file_get_contents ($FileName); And then just the INSERT The database table collocation is utf8_general_ci Thank you very much.
Hi, try mysql_query("SET NAMES utf8"); right after mysql_connect and db_select If still doesn't work, check that all your PHP files are saved as UTF-8. And if still nothing - visit http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html for some other tips from users
Hi, thanks, it seems that the problem was that some sources were coding with different code pages, I solved it with the mb_convert_encoding function