PHP mysql charset utf8问题 [英] PHP mysql charset utf8 problems
问题描述
可能重复:
UTF-8一路通过
I在其他人已经开发的网站上开发了一些新功能。
我遇到了问题的字符集。
我看到数据库有一些表在utf8和一些在latin1
所以我试图转换UTF8中的所有表。
我是为一个表(也是这个表的字段现在是utf8),但是不成功。
我'm使用正常的mysql connect。我必须把任何配置说,它必须连接到utf8到DB?
如果是的话, < meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
它看起来像一些字母作品,其他人显示问号。
例如,它不能显示这个是不同的:'
>
<?php
header('Content-Type:text / html; charset = utf-8' );
?>
,然后在连接中
<?php
$ dbLink = mysql_connect($ argHost,$ argUsername,$ argPassword);
mysql_query(SET character_set_results = utf8,$ dbLink);
mb_language('uni');
mb_internal_encoding('UTF-8');
mysql_select_db($ argDB,$ dbLink);
mysql_query(set names'utf8',$ dbLink);
?>
Possible Duplicate:
UTF-8 all the way through
I'm developing some new features on a website that somebody else already developed.
I'm having a problem the charset.
I saw that the database had some tables in utf8 and some in latin1
So I'm trying to convert all the tables in UTF8.
I did it for one table (also the fields of this table now are utf8), but was not successful.
I'm using the normal mysql connect. I have to put any config to say that it must connect with utf8 to the DB? If yes witch one?
In my html I have:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
It looks like some letters works and others display the question mark. For example it not able to display this ’ that is different of this: '
Try this
<?php
header('Content-Type: text/html; charset=utf-8');
?>
and then in the connection
<?php
$dbLink = mysql_connect($argHost, $argUsername, $argPassword);
mysql_query("SET character_set_results=utf8", $dbLink);
mb_language('uni');
mb_internal_encoding('UTF-8');
mysql_select_db($argDB, $dbLink);
mysql_query("set names 'utf8'",$dbLink);
?>
这篇关于PHP mysql charset utf8问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!