Mysql插入问题! (UTF8字符不显示)
可能的重复:
插入数据库问题...(错误字符编码)PHP/MYSQL< /a>
我有一个表单已提交到 mysql 数据库中。数据库设置为 UTF-8_GENERAL
并且行也使用相同的字符编码。
但是,当我提交文本中带有“ő”或“ű”的表单时,它不会在这些字符之后提交任何内容。 (例如:“这是美好的一天。”它只是将其插入数据库:“这是美好的”)
表单验证页面具有 mysql_real_escape_string()
; strip_tags()
;在提交到数据库之前。
我在每个字符串函数(如上所述)之后回显结果。一切正常,但是当插入时,它在这些字符之后不显示任何内容。
[MySql version: 5.0.51a-24+lenny5-log | Using phpMyAdmin version: 2.11.8.1deb5+lenny7]
我该如何解决这个问题?任何帮助表示赞赏...
Possible Duplicate:
Insert into database problem… (Bad character coding) PHP/MYSQL
I have a form which is submitted into a mysql database. The database is set to UTF-8_GENERAL
and the rows are using the same character coding as well.
But when I submit the form with a "ő" or "ű" in the text, it does not submit anything after these characters. (Example: "This is a nice ű day." It just inserts this into the db: "This is a nice")
The form validation page has the mysql_real_escape_string()
; strip_tags()
; before submitting to the db.
I echo out the result after every string function (mentioned above). It all works fine, but when it gets inserted, it doesn't display anything after those characters.
[MySql version: 5.0.51a-24+lenny5-log | Using phpMyAdmin version: 2.11.8.1deb5+lenny7]
How could I solve this? Any help appreciated...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对字符进行编码:
$string = mb_convert_encoding($variable, 'HTML-ENTITIES', 'UTF-8');
encode the characters:
$string = mb_convert_encoding($variable, 'HTML-ENTITIES', 'UTF-8');