what does GlideStringUtil.escapeHTML(); does?

dasbiswa
Tera Expert

what does GlideStringUtil.escapeHTML(); does?

3 REPLIES 3

anurag92
Kilo Sage

Some characters are not valid in Jelly HTML Script part . For eg"<" (you can try using this, and it will return and error). What escapeHTML does is, it converts invalid XML characters like "<" ,">","&" to its literal equivalent.


For eg:


var x = "<b>&TEST</b>";


gs.log(GlideStringUtil.escapeHTML(x));



Output:


&lt;b&gt;&amp;TEST&lt;/b&gt;


Manoj Kumar16
Giga Guru

It removes the HTML tags if any field contains them



example-


if short_description contains- <b>test</b> then the function below will return only test.



GlideStringUtil.escapeHTML(gr.short_description);




Correct