QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 4458|回复: 8

头痛大,Data too long for column错误

[复制链接]
发表于 2006-4-23 20:43:17 | 显示全部楼层 |阅读模式
Data too long for column 'textx' at row 1

我就一个表,表里就一个字段,字段名为textx,类型为text

我用php程序插入英文没有问题,只要一插入中文就出现:“Data too long for column 'textx' at row 1”

该字段已经是gb2312_chinese_ci了。

搞了一天了,不知道啥问题,人都变傻了
发表于 2006-4-23 21:12:51 | 显示全部楼层
google一下吧,全球使用MySQL并使用本土字符集的差不多都遇到了问题http://forums.mysql.com/read.php?103,51906,54224=

也有一位同胞
[code:1]
am interesting too!!! same problem with GBK chars !!!!

mysql> set names gbk;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into T_User(FName,FPassword) values('我们','123');
[/code:1]

我没有遇到这个问题,因为:
1. 我一直使用utf-8编码
2. 我已经使用PostgreSQL来替代MySQL了
回复

使用道具 举报

 楼主| 发表于 2006-4-23 21:22:23 | 显示全部楼层
他是在终端里不能插入本土字符。

我这个在终端里是可以插入的,如下
insert into userinfo (text) values ('我们 ');

但是在php程序里就无法插入
回复

使用道具 举报

发表于 2006-4-23 22:54:17 | 显示全部楼层
你的 locale 是啥?
utf-8 吧?
回复

使用道具 举报

 楼主| 发表于 2006-4-23 22:58:08 | 显示全部楼层
都是GBK
回复

使用道具 举报

发表于 2006-4-24 18:53:51 | 显示全部楼层
你把 locale 改成 utf8 或许就行了吧?
回复

使用道具 举报

 楼主| 发表于 2006-4-24 19:02:17 | 显示全部楼层

谢谢

找了一篇文章看完终于解决了,文章我收录了到我个人网站去了

http://www.xqs.cn/xqsblog/blogview.asp?logID=70

谢谢两位热心的斑竹,来亲一个
回复

使用道具 举报

发表于 2006-4-25 19:53:39 | 显示全部楼层

Re: 谢谢

[quote:8fa3f466ee="quicksand"]找了一篇文章看完终于解决了,文章我收录了到我个人网站去了

http://www.xqs.cn/xqsblog/blogview.asp?logID=70

谢谢两位热心的斑竹,来亲一个[/quote]

This solution has been published by bixuan, sirtoozee and other guys, if you search the posts backwards and forwards.

Again, PostgreSQL is better than MySQL.
回复

使用道具 举报

 楼主| 发表于 2006-7-19 11:50:50 | 显示全部楼层
问题已经解决很长时间了,再看看以前遇到得这些问题当时可头疼了

mysql_query("set names gb2312");
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-20 02:31 , Processed in 0.398235 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表