I am trying to insert Utf-8 string in a cell with utf8_general_ci collation
My code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...
print mb_detect_encoding($name);
$query = "INSERT INTO items SET name='$name', type='$type'";
print $query;
mysql_set_charset('utf8'); // also doesn't help
$result0 = mysql_query("SET CHARACTER SET utf8") or die(mysql_error()); // I've added this line, but it doesn't solve the issue
$result01 = mysql_query('SET NAMES utf8') or die("set character ".mysql_error()); // still nothing
$result = mysql_query($query) or die(mysql_error());
What I see in the html output:
UTF-8 INSERT INTO waypoints SET name='ČAS', type='ts'
What I see in the database, as name in the inserted row:
?AS
Now my string is utf-8, my table and cell is utf-8 .. why the wrong encoding?
mysql_set_charset()?