When having a file saved in ISO-8859-1 and using the command
echo "test: ".htmlspecialchars("äöü");
The return will be only "test: ".
This is because the standard charset for htmlspecialchars changed to UTF-8 in PHP5.4. You need to explicitly set the charset:
echo "test: ".htmlspecialchars("äöü", ENT_COMPAT | ENT_HTML401, 'ISO-8859-1');
Are there any other functions in PHP5.4, that will not work properly anymore, if you do not set the charset?
htmlentities
seems to be another function that was changed: http://de3.php.net/manual/de/migration54.other.php
The migration guide from PHP 5.2->5.3 does not give any more functions that changed the default charset: http://de3.php.net/manual/de/migration53.php
So probably it is only htmlspecialchars()
and htmlentities
Anyway, I think those two should definitely go to the "Backward Incompatible Changes"-list http://de3.php.net/manual/de/migration54.incompatible.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With