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ä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.
精彩评论