我正在尝试在带有utf8_general_ci
排序规则的单元格中插入 Utf-8 字符串
我的代码:
<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());
我在 html 输出中看到的内容:
UTF-8 INSERT INTO waypoints SET name='ČAS', type='ts'
我在数据库中看到的内容,如name
插入的行中:
?AS
现在我的字符串是 utf-8,我的表格和单元格是 utf-8 .. 为什么编码错误?