I have user input and use htmlentities() to convert all entities. However, there seems to be some bug. When I type in
ääää öööö üüüü ääää
I
You must manually specify the encoding (UTF-8
) for htmlentities():
echo htmlentities("ääää öööö üüüü ääää", null, "UTF-8");
Output:
ääää öööö üüüü ääää
it is important that 3th parameter of htmlentities matches the character set that uses the post. I supouse, you are NOT submiting utf8, as it is the default in htmlentities
in PHP
$post = htmlentities ( $post, ENT_COMPAT, 'ISO-8859-1') // or whatever
in Form
<form action="your.php" accept-charset="ISO-8859-1">
anyway, actualy I recommend you to use utf8