我的页面是这样写的:<html lang="gb2312" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />但是客户端firefox显示却总是乱码,我用http-fox查看通信过程,发现HTTP response中的content-type居然是:
Content-Type text/html; charset=UTF-8
为什么我的页面中的html的lang属性和meta标签设置的content-type都没有起作用?我只好在生成页面的php文件中加上header("Content-Type: text/html;charset=gb2312");这时firefox正确显示了页面,用http-fox查看发现http response中的content-type也正确。
请问这是为什么?
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />但是客户端firefox显示却总是乱码,我用http-fox查看通信过程,发现HTTP response中的content-type居然是:
Content-Type text/html; charset=UTF-8
为什么我的页面中的html的lang属性和meta标签设置的content-type都没有起作用?我只好在生成页面的php文件中加上header("Content-Type: text/html;charset=gb2312");这时firefox正确显示了页面,用http-fox查看发现http response中的content-type也正确。
请问这是为什么?
文件编码
html标签指定编码
php程序指定编码如果有数据库,数据库也要指定编码