htmlspecialchars_decode shows tags instead of formatting

362 views Asked by At

I have stored some mathematics questions in the mysql database having UTF-8 columns as below:

htmlspecialchars($data, ENT_QUOTES, 'UTF-8');

which stores the question in database as:

log<sub>2</sub>(log<sub>5</sub>625)का मान ज्ञात करें ?

Now, I call this question from database to frontend as below:

htmlspecialchars_decode($quest, ENT_QUOTES)

which shows the following output:

log<sub>2</sub>(log<sub>5</sub>625)का मान ज्ञात करें ?

while the output should be

log2(log5625)का मान ज्ञात करें ?

How to resolve this? What I am missing?

2

There are 2 answers

0
Shobhit Gupta On BEST ANSWER

try this: html_entity_decode(htmlspecialchars_decode($quest,ENT_QUOTES)) and problem will be solved for sure.

4
Rohit On

This seems correct when you display this HTML on browser this will render as below:

log<sub>2</sub>(log<sub>5</sub>625)का मान ज्ञात करें ?