php - Convert special characters to HTML character codes -
i'm developing cms customer , needs edit stuff , use special characters such ç
, ®
. however, don't want him have enter character codes ®
. knows way automatically convert characters using php?
you can use htmlentities() that.
php -r 'echo htmlentities("®ç", ent_compat, "utf-8"), "\n";' ®ç
to turn entities readable text, use html_entity_decode():
php -r 'echo html_entity_decode("®ç", ent_compat, "utf-8"), "\n";' ®ç
if you're not using unicode, omit charset name or give correct charset.
Comments
Post a Comment