How do I use PHP's html_entity_decode() with an exception for numeric HTML entities 60 and 62?
Currently my code looks something like the following:
$t = mysqli_real_escape_string($db,html_entity_decode($_POST['title'],ENT_COMPAT,'UTF-8'));
However if I have that are encoded to display as carets in content (just as you would display an ampersand directly to a client) they too become encoded and this has led to malformed HTML. So I need to make some sort of exception though I'm not sure how to do this; string replacement with a temporary placeholder? I'm sure there is a better way.
html_entity_decodeis designed to handle such (or can handle it correctly).<and>(the < and > caret characters) if you convert them to regular characters then there is zero distinction in the system how to convert them back so they must remain encoded when going in to the database; never allow code to be stored subjective to requiring human interpretation because websites aren't manually served by humans, they're automatically served by servers and software.<and>are better called angle brackets.^is a caret (and is unaffected by HTML encoding or decoding).