I'm trying to put html into a mailto link (<a href='mailto:...
) and using htmlescapechars() but this doesn't seem to be what I need.
<a href='mailto:?subject=<?echo $subject_e=htmlspecialchars($subject, ENT_QUOTES)?>&body=<?=$subject_e?>%20via%20https://mySite.com/<?=htmlspecialchars($subjectLink, ENT_QUOTES)?>%20'>some text</a>
Can anyone explain under what conditions Example #1 in the htmlspecialchars() part of PHP's documentation works?
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new; // <a href='test'>Test</a>
Running this function on my own server or on http://writecodeonline.com/php/ doesn't seem to convert the special characters.
So it doesn't appear to be a PHP version issue. Including the encoding
parameter also had no effect. Wtf?