php - Can't decode my HTML entities -
i storing raw html this...
nl2br(htmlentities($this->input->post('raw_html')))
in database data looks this...
<ul> <li>improve our understanding of issue</li> <li>strengthen listening , writing skills</li> </ul>
when try , display markup database use this:
echo html_entity_decode($html_from_db, ent_compat, 'utf-8');
but output being shown in browser:
<ul> <li>improve our understanding of issue</li> <li>strengthen listening , writing skills</li> </ul> lesson name
and html entities shown in source code... no entities being decoded.
why not working?
probably when you're using encode htmlentities
encoded twice. see @ function params:
function htmlentities ($string, $quote_style = null, $charset = null, $double_encode = true) {}
so can try this:
nl2br(htmlentities($this->input->post('raw_html'), ent_quotes, 'utf-8', false))
Comments
Post a Comment