I'm writing a simple webpage with PHP and for security reasons I pass certain form values through the PHP htmlentities() function. However, even though I specify a UTF-8 format it doesn't seem to be able to handle the characters "åäö". This is my code:
echo htmlentities("Hello", ENT_QUOTES, "UTF-8");
echo htmlentities("Hello åäö", ENT_QUOTES, "UTF-8");
The first line outputs "Hello" and the second one outputs "". Why is this? Have I missed anything?
EDIT:
There seems to be a problem with my encoding settings. This is the full code. Propably a silly error but I'm new to HTML/PHP.
<?php
header('Content-Type: text/html; charset=utf-8');
?>
<html>
<head>
<title>Testing</title>
</head>
<body>
<?php echo htmlentities("Hello", ENT_QUOTES, "UTF-8") . htmlentities("Hello åäö", ENT_QUOTES, "UTF-8");?>
</body>
</html>