On a webserver, I have a php script that parses a .sql file (which is stored directly on the server), and executes the queries on a mysql database. I have a lot of french characters that doesn't insert well: é becomes é.
When I open the sql file with notepad++, I see that the encoding is "uft-8 without BOM".
My script looks like this:
$handle = fopen("test.sql", "r") or die("couldn't get handle");
if ($handle)
{
while (!feof($handle))
{
$buffer = fgets($handle, 4096);
if (strlen ( $buffer ) < 3 ) // if we have a blank line
{
mysql_query($query);
$query = $buffer;
sleep(0.5);
}
else
{
$query .= $buffer;
}
}
mysql_query($query); // last insert
fclose($handle);
}
When I open the database through phpmyadmin, I see that the special chars are already broken right after the execution of the script.