0 votes

Hi guys,

Does anybody knows why, in Efficy 11.1, the function EscapeHTML is not working anymore when you use runscript from a template to return from sys_storage?
And can we use import to make it available again?



asked in Efficy/ Client side by (188 points)

2 Answers

+2 votes

The function EscapeHTML is no longer published for scripting, it has been replaced by contextEncodeText.

See https://help.efficy.com/edn/serverjs#Library-contextEncodeText

To be honest, we could also have kept "EscapeHTML" and remapped it to "contextEncodeText" to avoid your having to change your current scripts.
I'll add this to the next corrective build for Efficy 11.1 and the forthcoming build for Efficy 11.2.

answered by (1k points)
+1 vote

It seems deprecated since 11.1.

Use contextEncodeHtml instead:

Encodes a string for the HTML output context: raw data that must be rendered as HTML (e.g. WYSIWYG editors, formatted memos).

This method is a shortcut to contextEncode(s, 'HTML');

answered by (7k points)
There is a difference:
- contextEncodeHtml() is used for HTML that needs to be rendered inside HTML editors or formatted memos.
- contextEncodeText() is used for text you want to put in an HTML page

99% of the time you're probably going to use contextEncodeText, the other method really is for special cases.
1,193 questions
1,459 answers
327 users