I have a string stored in an array: But I Don't
and when I print it on my webpage I get: But I Don’t
I've tried htmlentities()
, htmlspecialchar()
, both with ENT_QUOTES
enabled.
I realize I can force my function to do a string replace each time I print, but surely there's a way in PHP that I can go through my array, printing each string, and have it convert all special characters (not just quotes) into proper html?
I'm just baffled that some how apostrophes didn't make the cut for string sanitization.
EDIT
Turns out it was a back tick after all, so the string was: "But I Don`t"
Is there an easy way to sanitize this in PHP as well?