If there is a file stored in ISO-8859-1, and using the command
echo "test: ".htmlspecialchars("äöü");
The return will only be "test:".
This is because the standard encoding for htmlspecialchars has changed to UTF-8 in PHP5.4. You need to explicitly set the encoding:
echo "test: ".htmlspecialchars("äöü", ENT_COMPAT | ENT_HTML401, 'ISO-8859-1');
Are there any other functions in PHP5.4 that will no longer work properly if you don't set the encoding?
source
share