[英]how to display this chinese character?
I already set mySQL Collation as utf8_unicode_ci, if I manual insert chinese character in my database, it's successful work to displaying chinese character, but once i use my code, it was display this 我已经将mySQL Collation设置为utf8_unicode_ci,如果我在数据库中手动插入汉字,则显示汉字是成功的工作,但是一旦使用代码,它就会显示
ã€å¼µç'žæŒ¯ã€æ±Ÿç¥¥ç¶ .. ž...
I had add this <meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
in my header, I had try utf8_encode ,but still the same problem happen. 我在标头中添加了此
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
,但我尝试过utf8_encode,但仍然发生相同的问题。
thank you and hope you guy reply me soonest 谢谢,希望你能尽快答复我
Have you set the connection character set / collation? 您是否设置了连接字符集/排序规则? Execute this query immediately after creating a connection
建立连接后立即执行此查询
SET NAMES 'utf8'
You have probably forgot to execute this query after connecting 您可能忘记了在连接后执行此查询
SET NAMES utf8
Try it and you'll see 试试看,你会看到
there 2 steps you should do 有两个步骤,你应该做
add a query with UTF8 使用UTF8添加查询
$query = "SET NAMES 'utf8'";
mysql_query($query);
make sure your file is encoded as UTF8, open your script with your favourite editor and save as UTF8 确保您的文件编码为UTF8,使用您喜欢的编辑器打开脚本并另存为UTF8
To ensure MySQL expects UTF-8 encoding by default from client connections, use the following query: 为了保证从MySQL的客户端连接的默认预计UTF-8编码,请使用以下查询:
SET NAMES 'utf8'
In addition, make sure PHP interprets the string as UTF-8 string. 此外,请确保PHP将字符串解释为UTF-8字符串。 Since PHP does not support multibyte characters, you must use a function to allow PHP to work with UTF-8 strings:
由于PHP不支持多字节字符,因此必须使用允许PHP使用UTF-8字符串的函数:
utf8_decode()
or something. 或者其他的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.