MySQL数据库混沌代码保存越南随机码解决方案

我测试自己,许多字符变成。

数据库连接已经使用UTF8字符集:

复制代码代码如下所示:
定义(mysql_encode

mysql_query(让名字。mysql_encode,美元Conn)或死亡(字符集设置错误。mysql_error());


半个小时没做完了。

插入的数据仍然混乱,突然想起来,这不是一个不能拯救越南人的领域吗。

我看了看数据库字符集,默认是GBK,这在中国是没有问题的,只要越南语言、代码。

So, I modified the character set that might use the Vietnamese field to utf8, and the proofreading was modified to: utf8_unicode_ci.(it is necessary to modify a particular field, modify the character set of the whole table, do not work, or retain the original character set) to solve the problem.

我的数据库是:php_college_web

表:city_article

越南语中使用的字段:标题、内容

因此,执行以下SQL:

复制代码代码如下所示:
修改表city_article改变标题varchar(100)整理utf8_unicode_ci utf8字符集

修改表city_article改变内容的文本字符集utf8整理utf8_unicode_ci