apache 显示html,apache 的网页内容显示是乱码

我改的是/etc/apache2/apache2.conf,

1.注释掉AddDefaultCharset一行也没用,和原来 一样还是乱码。

2.改成AddDefaultCharset off 或是 AddDefaultCharset GB2312 也是一样的,总是apache自动默认的ISO-8859-1,依然是乱码.

3.再改成AddDefaultCharset UTF-8,也没有用,还是乱码。

每次改完,都分别重启apache。

4.在该文件中加入下面的两句

AddDefaultCharset GB2312

DefaultLanguage GB2312

还是乱码,没有用。

应该没改错文件呀,

后来发现,配置文件里的 那个 AddDefaultCharset 影响不到 apache 的 Index of 页面。

随便怎么改,查看到的http头,都是如下,字符编码总是charset=ISO-8859-1

例如 wget -S

newman0708@newman0708-desktop:~$ wget -S

--08:51:07--  /

=> `index.html'

Connecting to 172.26.29.82:80... connected.

HTTP request sent, awaiting response...

HTTP/1.1 200 OK

Date: Thu, 28 Aug 2008 00:51:07 GMT

Server: Apache/2.2.3 (Ubuntu) mod_jk/1.2.18 mod_python/3.2.10 Python/2.5.1 PHP/5.2.1

Content-Length: 1330

Keep-Alive: timeout=15, max=100

Connection: Keep-Alive

Content-Type: text/html;charset=ISO-8859-1Length: 1,330 (1.3K) [text/html]

100%[====================================>] 1,330         --.--K/s

08:51:07 (63.21 MB/s) - `index.html' saved [1330/1330]

我在windows下访问也是一样乱码,安装中文包是没有用,肯定问题出在apache的设置上。

得到论坛上maitr 的提示,问题就解决了。

在/etc/apache2/apache2.conf尾部添加下面内容,就可以解决。

IndexOptions Charset=utf-8

Options Indexes FollowSymLinks

AllowOverride All

Order allow,deny

Allow from all

然后再用wget -S 查看http头,

newman0708@newman0708-desktop:~$ wget -S

--08:51:07--  /

=> `index.html'

Connecting to 172.26.29.82:80... connected.

HTTP request sent, awaiting response...

HTTP/1.1 200 OK

Date: Thu, 28 Aug 2008 00:51:07 GMT

Server: Apache/2.2.3 (Ubuntu) mod_jk/1.2.18 mod_python/3.2.10 Python/2.5.1 PHP/5.2.1

Content-Length: 1330

Keep-Alive: timeout=15, max=100

Connection: Keep-Alive

Content-Type: text/html;charset=utf-8Length: 1,330 (1.3K) [text/html]

100%[====================================>] 1,330         --.--K/s

08:51:07 (63.21 MB/s) - `index.html' saved [1330/1330]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值