The code I posted this morning (for giving back to htmlspecialchars etc. the old default ISO encoding) had some strange problem, didn't work if a page was reloaded! Here the code I came up with, without this problem:
<?php
if (version_compare(phpversion(), "5.3.3", ">")) {
runkit_function_copy('htmlspecialchars', 'htmlspecialchars_new');
runkit_function_redefine(
'htmlspecialchars',
'$string, $flags, $encoding',
'return $encoding == "" ? htmlspecialchars_new($string, ENT_COMPAT | ENT_HTML401, "ISO-8859-1") : htmlspecialchars_new($string, $flags, $encoding);'
);
runkit_function_copy('htmlentities', 'htmlentities_new');
runkit_function_redefine(
'htmlentities',
'$string, $flags, $encoding',
'return $encoding == "" ? htmlentities_new($string, ENT_COMPAT | ENT_HTML401, "ISO-8859-1") : htmlentities_new($string, $flags, $encoding);'
);
runkit_function_copy('html_entity_decode', 'html_entity_decode_new');
runkit_function_redefine(
'html_entity_decode',
'$string, $flags, $encoding',
'return $encoding == "" ? html_entity_decode_new($string, ENT_COMPAT | ENT_HTML401, "ISO-8859-1") : html_entity_decode_new($string, $flags, $encoding);'
);
}
?>
So first I copy the original function, then I redefine the same.