cancel
Showing results for 
Search instead for 
Did you mean: 

XSJS HTML Encode Decode

former_member365641
Participant
0 Kudos
477

Hi All,

do you know if it's possible to decode an HTML string with XSJS?

I mean for example from $lt;mytag$gt; to <mytag> (replace $ with & otherwise it convert to text)

I found this library $.util.codec but don't contains nothing about HTML.

Gennaro

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor

I do not know a functionality/lib which is shipped with XS Classic to do HTML string escaping/unescaping. But you can create your own library providing that functionality.

Create a new xsjslib file e.g. utils.xsjslib in a package (e.g. tools) and paste following coding into it (sorry for the screenshot, but the code plugin coverts escaped character sequences). This library provides the functions escapeHtml and unescapeHtml for escaping/unescaping:

To use the library, just import it to your xsjs file and call the functions, e.g.

The example creates following result:

Answers (0)