Home  >  Article  >  Backend Development  >  为什么有些汉字不能提交到数据库中?该如何解决

为什么有些汉字不能提交到数据库中?该如何解决

WBOY
WBOYOriginal
2016-06-13 13:53:291089browse

为什么有些汉字不能提交到数据库中??
我的数据库用的是mysql

数据库test 编码是 gb2312 里面有个表news,编码也是gb2312,有个字段 title 类型是varchar

现在我提交数据到表news里,我提交的数据是“祭”,但是会报错,这个字不是简体字吗?为什么不能保存到数据库里呢?

着急~ 唉~

------解决方案--------------------
这个明显是gbk的字啊大哥
------解决方案--------------------
你先写SQL语句直接执行插入看看, 如果可以写入数据库说明是你的程序问题, 如果不行就检查你的数据库.
------解决方案--------------------
遇到这种情况就把字符集朝大了改!
------解决方案--------------------
utf-8就行了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn