I want to output the following string in PHP:
ä ö ü ß €
Therefore, I’ve encoded it to utf8 manually:
ä ö ü ß €
So my script is:
<?php
header('content-type: text/html; charset=utf-8');
echo 'ä ö ü ß €';
?>
The first 4 characters are correct (ä ö ü ß) but unfortunately the € sign isn’t correct:
ä ö ü ß
Can you tell me what I’ve done wrong? My editor (Notepad++) has settings for Encoding (Ansi/UTF-8) and Format (Windows/Unix). Do I have to change them?
I hope you can help me. Thanks in advance!
That last character just isn’t in the file (try viewing the source), which is why you don’t see it.
I think you might be better off saving the PHP file as UTF-8 (in Notepad++ that options is available in Format -> Encode in UTF-8 without BOM), and inserting the actual characters in your PHP file (i.e. in Notepad++), rather than hacking around with inserting
Ãeverywhere. You may find Windows Character Map useful for inserting unicode characters.