php - Convert both, Unicode entities and HTML entities -
after spending entire morning going through questions on stack overflow, i'm seeking help. need convert both, unicode entities , html entities utf-8 text.
$string = "let's "kiss & makeup""; //-> let's kiss & makeup "lalala"
i manage decode html entities alone (using html_entity_decode()
, htmlspecialchars_decode
). not linked polyfill trick. since none of functions tried decoded unicode entities, haven't tried figuring out how combination of decoding functions.
the issue single quotes , default ent_compat
flag of html_entity_decode
, "leaves single-quotes alone". set ent_quotes
flag instead convert quotes:
echo html_entity_decode($string, ent_quotes | ent_html401, 'utf-8');
Comments
Post a Comment