如何在PHP中将特殊语言字符插入MySQL数据库? [英] How to insert special language characters in PHP into MySQL database?

查看:110
本文介绍了如何在PHP中将特殊语言字符插入MySQL数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用最新的PHP和最新的MySQL. 我试过了htmlspecialchars和mysql_real_escape_string,但是它插入了吗?而不是特殊字符. 我要插入varchar和文本类型字段.特殊语言字符,例如őúáűăţşîâ,但它可能是其他语言的字符.

I am using latest PHP and latest MySQL. I have tried htmlspecialchars and mysql_real_escape_string but it inserts ? instead of the special character. I am inserting into varchar and text type fields. Special language characters like őúáűăţşîâ but it maight be other languages' characters.

推荐答案

检查服务器的默认编码,元标记编码声明以及数据库和表上的排序规则.如果您要使用很多语言字符,则可能要确保将所有内容都设置为UTF8.

Check the default encoding for your server, your meta-tag encoding declaration, and your collation on your database and tables are. You may want to make sure that everything is set to UTF8 if you're going to have lots of language characters.

这篇关于如何在PHP中将特殊语言字符插入MySQL数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆