Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to escape html using htp.p?

YounJul 9 2021

Hello community,

I have the following html code in PL SQL :
MyCode varchar2(500) := '<div>Hi</div>';
I would like to print this code as it is. Means I don't want '< div >' to be interpreted as an html tag. I'm expecting the same text printed : **< div >Hi</ div>** (and not only **Hi**)
I tried :
htp.p(UTL_URL.ESCAPE(MyCode, true));
htp.p(htf.escape_sc(MyCode));
But nothing works. The first one returns : %3Cdiv%3Ehi%3C/div%3E. And the second : Hi (it interprets the code as HTML)
While I'm expecting it to print
<div>Hi</div>
Can anyone know how to solve that please ?
Thanks

Comments
Post Details
Added on Jul 9 2021
3 comments
1,241 views