Php Obfuscating Mailto In Source With Htmlentities()
Solution 1:
The misunderstanding may be from http://php.net/manual/en/function.htmlentities.php
This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.
What it really means from http://php.net/manual/en/function.htmlspecialchars.php
Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings.
htmlspecialchars()
encodes: &
, "
, '
, <
and >
. Check:
print_r(get_html_translation_table(HTML_SPECIALCHARS));
htmlentities()
encodes more characters, but only characters that have special significance in HTML. Check:
print_r(get_html_translation_table(HTML_ENTITIES));
You might look at something like this. I checked it in a link and it worked as expected:
$result = preg_replace_callback('/./', function($m) {
return'&#'.ord($m[0]).';';
},
'mailto:fake@test.com');
This replaces each character in a string with &#
then the ASCII value of the character and then ;
Post a Comment for "Php Obfuscating Mailto In Source With Htmlentities()"