使用 PHP 保存日语字符
我目前正在尝试在 PHP 中使用 MySQL 保存日语字符串。这些字符被保存为问号。这是我的查询:
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'");
$result = mysql_query("INSERT INTO battles (basic_words) VALUES ('".mysql_real_escape_string($basic_words)."'");
字符串“$basic_words”肯定包含日语字符,但它们没有保存。 “basic_words”行的联盟是utf8_general_ci
I'm currently trying to save a japanese-character string with MySQL in PHP. The characters are saved as questionmarks. This is my query:
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'");
$result = mysql_query("INSERT INTO battles (basic_words) VALUES ('".mysql_real_escape_string($basic_words)."'");
The string "$basic_words" definitely contains japanese characters but they are not saved. The coalition for the row "basic_words" is utf8_general_ci
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
php mysql查询编码问题建议
同时检查http://php.net/manual/en/function.mysql-set-charset.php
php mysql query encoding problem suggests
Also Check http://php.net/manual/en/function.mysql-set-charset.php