2

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 outputs "Niederländische Zitate"

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

Anyone has an idea how to fix this?

Paul Dixon
  • 295,876
  • 54
  • 310
  • 348
Simon
  • 5,464
  • 6
  • 49
  • 85
  • What precisely is the difference between your two inputs? When SO renders your question, both are identical. – dkarp Jan 16 '11 at 15:14

1 Answers1

2

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.

shamittomar
  • 46,210
  • 12
  • 74
  • 78