我曾与托管2个不同的供应商计划,对供应商我的网站的工作没有一个单一的问题,但对商B不管我做什么了UTF-8永远不会奏效。
在这两个托管的网站是准确的在各方面都一样的,所以我们在这里唯一的区别是服务器。
如果我简单的创建一个记事本上节约以下内容为UTF-8 ENC文件:
<?php
header('content-type: text/html; charset: utf-8');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?
$var = "áéíóí";
echo $var;
?>
<body>
<html>
它工作正常上托管,但无法显示在主机B的字符
我检查了两个php.ini的文件,都具有相同的信息。
我还有什么可尝试,改变或试图获得UTF-8上托管B干活,?
从我可以告诉它似乎entirelly服务器端的问题,一些配置丢失或指定,否则为什么同样的网站将在托管而不证明一个问题开展工作?
卷曲响应主机B:
root@server:~# curl -v http://painel.xxxxxx.com/test.php
* About to connect() to painel.xxxxxx.com port 80 (#0)
* Trying 10.0.0.2... connected
* Connected to painel.xxxxxx.com (10.0.0.2) port 80 (#0)
> GET /test.php HTTP/1.1
> User-Agent: curl/7.20.1 (i686-pc-linux-gnu) libcurl/7.20.1 OpenSSL/0.9.8n zlib/1.2.5 libidn/1.5
> Host: painel.xxxxxx.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 15 Sep 2011 11:55:33 GMT
< Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8n DAV/2 mod_python/3.3.1 Python/2.6.4 PHP/5.3.6 SVN/1.6.11 mod_fastcgi/2.4.6
< X-Powered-By: PHP/5.3.6
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=utf-8
<
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
áéíóíaed<body>
* Connection #0 to host painel.xxxxxx.com left intact
* Closing connection #0
<html>
萤火响应从我的电脑主机B:
HTTP/1.1 200 OK
Date: Thu, 15 Sep 2011 12:06:21 GMT
Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8n DAV/2 mod_python/3.3.1 Python/2.6.4 PHP/5.3.6 SVN/1.6.11 mod_fastcgi/2.4.6
X-Powered-By: PHP/5.3.6
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
Host painel.xxxxxxx.com
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language pt-br,pt;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection keep-alive
Cookie
Cache-Control max-age=0
到目前为止已经试过:
- 从操作系统到en_US.UTF8改变HTE语言环境
- 更改默认字符集上的Apache
- 设置php.ini中的沙雷为UTF-8
- 文件保存在UTF8
- 同一文件上都托管计划测试,只能在主机A.
- 在代码的第一行
mb_internal_encoding("UTF-8");
- 在代码的第一行
setlocale(LC_CTYPE, 'C');
- 的2的上方一起
-
header('content-type: text/html; charset: utf-8');
和header('content-type: text/html; charset=utf-8');