开发者

Encoding Issue Title Tag

I've got a little problem with the tag in combination with PHP. My code is:

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

When i use "Niederländische Zitate" the browser outputs "Niederl�ndische Zitate" When i use "Niederl&auml;ndische Zitate" the browser ou开发者_如何学编程tputs "Niederländische Zitate"

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

Anyone has an idea how to fix this?


In addition to meta tag, you also need to:

a) send UTF-8 header like this:

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

in the very beginning of your script.

b) and save the script file as UTF-8 without BOM encoding. Use any good code editor, like Notepad++ which allows this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜