3-PHP全部编码UTF-8
0-html
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<form accept-charset="UTF-8"></form>
1-css
@CHARSET "UTF-8";
2-js
<script src="search.js" charset="UTF-8"></script>
3-php
header("Content-type:text/html; charset=utf-8");
4-mysql
mysqli_query("SET NAMES UTF8");
5-apache
vim /etc/php.ini
default_charset="utf-8"
vim /etc/httpd/conf/httpd.conf
# AddDefaultCharset UTF-8
6-centos
查看当前系统默认采用的字符集
命令:locale 或者echo $LANG
安装中文包
yum -y groupinstall chinese-support
查看:yum list kde*chinese
安装:yum install kde-l10n-Chinese.noarch;
vim /etc/locale.conf
将LANG="XXXX" 改为LANG="zh_CN.UTF-8"
方法2:
cat /etc/locale.conf
cp /etc/locale.conf /etc/locale.conf_bak
vim /etc/locale.conf
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en"
SYSFONT="lat0-sun16"
reboot