【发布时间】:2013-08-16 14:46:45
【问题描述】:
我将 PHP 5 和 Apache 都设置为使用 UTF-8 编码。 我试图在我的浏览器中显示这个 PHP 代码的结果:
echo "Trying to visualize the letter ü"
它向我展示了这个结果:
Trying to visualize the letter �
为什么?
【问题讨论】:
-
您的文件是 UTF-8(没有 BOM)吗?你的
Content-Type也是 UTF-8 吗? -
可能必须显示您在哪里进行了配置更改。在我看来,您只是没有正确设置它
-
@Glavić 我怎么看出来的?反正我是用记事本写的(win 8)
-
@ಠ_ಠ 我在 php conf 文件中添加了 "default_charset = "utf-8";"并在 apache conf 文件“AddDefaultCharset UTF-8”
-
试试这个
<?php header('Content-Type: text/plain; charset=utf-8'); echo "Trying to visualize the letter ü";