2008-02-26
mysql数据库字符集疑惑问题之FAQ
关键字: mysql, php, charset, 字符集
1. mysql_client_encoding()是干什么的?他存在哪些问题?
手册上说mysql_client_encoding
2. 他到底是返回character_set_server, character_set_system 系统变量的值,还是character_set_connect或character_set_client系统变量的值呢?
经过测试,以上全部是,不知道他返回的是哪个值。
3. 怎样修改他的返回值?
http://cn.php.net/manual/en/function.mysql-client-encoding.php上讨论得如火如荼,但是问题仍然没有解决:
如果你的php版本>= 5.2.3,会有这么一个函数,mysql_set_charset()它可以改变mysql_client_encoding的返回值。但这只是形式上的,实际上你不需要顾问这个返回值,只要
4. set names 'charset' 和 set character set 'charset'有什么区别?
有一点区别,不过大多数情况下一样。
set names 'x'等价于:
而set character set 'x'等价于:
手册上说mysql_client_encoding
引用
Returns the default character set name for the current connection.
2. 他到底是返回character_set_server, character_set_system 系统变量的值,还是character_set_connect或character_set_client系统变量的值呢?
经过测试,以上全部是,不知道他返回的是哪个值。
3. 怎样修改他的返回值?
http://cn.php.net/manual/en/function.mysql-client-encoding.php上讨论得如火如荼,但是问题仍然没有解决:
引用
even if all your HTML/php source files are stored as 'utf-8' with header
<mata http-equiv="Content-type" content="type: text/html; charset=utf-8" />
and mysql server is everywhere UTF-8, adding 'set names "utf8"' and 'set character set "utf-8"' into your php to mysql connection,
you will always get the 'latin1' result by mysql_client_encoding();
<mata http-equiv="Content-type" content="type: text/html; charset=utf-8" />
and mysql server is everywhere UTF-8, adding 'set names "utf8"' and 'set character set "utf-8"' into your php to mysql connection,
you will always get the 'latin1' result by mysql_client_encoding();
如果你的php版本>= 5.2.3,会有这么一个函数,mysql_set_charset()它可以改变mysql_client_encoding的返回值。但这只是形式上的,实际上你不需要顾问这个返回值,只要
set names '你想要的字符集'就可以了
4. set names 'charset' 和 set character set 'charset'有什么区别?
有一点区别,不过大多数情况下一样。
set names 'x'等价于:
SET character_set_client = 'x'; SET character_set_results = 'x'; SET character_set_connection = 'x';
而set character set 'x'等价于:
SET character_set_client = 'x'; SET character_set_results = 'x'; SET collation_connection = @@collation_database;
- 17:11
- 浏览 (208)
- 评论 (1)
- 分类: Web Development
- 进入论坛
- 相关推荐
发表评论
提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则
- 浏览: 55834 次
- 性别:

- 来自: 乌托邦

- 详细资料
搜索本博客
最近加入圈子
链接
最新评论
-
【团队管理】大家Have A ...
sg552 写道 今天白天要出去,晚上回来,或者明天的时候,好好帮你分析一下。 ...
-- by rj045wq -
【团队管理】大家Have A ...
那就试试每天早上花个20分钟开个早茶会,让每人介绍下自己在干的活,以及需要什么帮 ...
-- by xiaolin0105 -
【团队管理】大家Have A ...
早上起来看到回帖,呵呵,楼主别激动。我知道我的帖子写的非常概括。因为之前只是把自 ...
-- by sg552 -
【团队管理】大家Have A ...
sg552 写道不是我故意跟你作对。 我觉得你确实很需要提高。犯了很多大忌。 也 ...
-- by xombat -
【团队管理】大家Have A ...
抛出异常的爱 写道 你管的太多。 放下手中的事 让他们自己决定要干什么不要干什么 ...
-- by xombat






评论排行榜