【发布时间】:2011-05-12 21:23:53
【问题描述】:
我的 mysql 插入语句有问题。 我有一个表单可以正确地向插入文件提交 utf-8 字符(我已经检查了 POST 变量)。
现在当我在我的数据库中处理 INSERT 时,没有变音符号,而是问号。
错误必须在插入语句之前。
如果我从我的数据库中输出(手动输入)内容,则元音变音会正确显示。
// echo $_POST["title"];
// outputs correctly with special chars: "Some german title with umlaute ä ö ü"
mysql_query("INSERT INTO videos (youtube_hash, title, description, category, created) VALUES ('".mysql_real_escape_string($_POST["hash"])."', '".mysql_real_escape_string($_POST["title"])."', '".mysql_real_escape_string($_POST["desc"])."', '".mysql_real_escape_string($_POST["cat"])."', '".time()."')") or die(mysql_error());
// database entry looks like this: "Some german title with umlaute ? ? ?"
我希望任何人都可以帮助我:)
编辑:
htmlentities() 完成了这项工作!
【问题讨论】:
-
你的数据库编码是什么?
-
insidemac-blog.de/bilder/2008/03/scheissencoding.jpg - 欢迎来到编码地狱 :)