htmlspecialchars $_POST and empty string, PHP 5.4 and ISO-8859-1

493 views Asked by At

after updating to PHP 5.4, I can't have working a script I'm using, and I found the problem being htmlspecialchars (I get empty string with € symbol and accented characters).

I tried with a simple form in an html page:

    <form action="special.php" method="post">
    field1: <input type="text" name="field1">
    <input type="submit">
    </form>

and in special.php:

<?php echo htmlspecialchars($_POST[field1]); ?>

setting different charsets in the header (ISO-8859-1, ISO-8859-15, UTF-8), specifying different parameters for the function (flags, character-set), and also trying htmlentities, but couldn't find a solution.

Any idea if I'm missing something or something should be changed in server configuration?

Thanks a lot, Igor

0

There are 0 answers