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

Popular posts from this blog

4x4 Matrix in Python -

python - String indices must be integers and while issue -

wso2is - WSO2 IS 5.0.0 SP1 After restart there is authentication error -