2

与 PHP 结合使用的标签有一点问题。我的代码是:

$title = '....';
echo '<title>'.htmlspecialchars($title).'</title>';

当我使用"Niederländische Zitate"浏览器输出“Niederländische Zitate” 当我使用"Niederl&auml;ndische Zitate"浏览器输出“Niederländische Zitate”

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

任何人都知道如何解决这个问题?

4

1 回答 1

2

除了元标记,您还需要:

a)像这样 发送 UTF-8 header

 header ('Content-type: text/html; charset=utf-8');

在脚本的开头。

b) 并将脚本文件保存为UTF-8 without BOM编码。使用任何好的代码编辑器,比如允许这样做的 Notepad++。

于 2011-01-16T15:13:34.283 回答