Hi,
I am trying to encode a string using html_entity_decode(). The string looks like this: "bla <bli> bla".
Unfortunately html_entity_decode() cuts out <bli> from the string and returns "bla bla". I tried using < > instead of < > but no change <bli> is cut out too. If submitting the string "bla <> bla" html_entity_decode() returns "bla <> bla".
Any suggestions please how I could make it leave "<bli>" unchanged?
Tiha
html_entity_decode() and < > characters
Moderator: General Moderators
Re: html_entity_decode() and < > characters
Just a suggestion, but I think htmlspecialchars() & htmlspecialchars_decode() should work better for you.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: html_entity_decode() and < > characters
Well first, you can't decode < and > because they aren't coded. Second, it isn't stripping those, you just can't see <bli> in a browser because it interprets it as a tag. Try doing a var_dump() or view source of your page.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: html_entity_decode() and < > characters
Thank you for your replies. Will try htmlspecialchars() and report back.
To AbraCadaver: html_entity_decode() is actually stripping <bli> from my string, I looked in the source of the page and it was not there hidden as a tag.
To AbraCadaver: html_entity_decode() is actually stripping <bli> from my string, I looked in the source of the page and it was not there hidden as a tag.