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

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -