OpenWGA 7.0 - TMLScript reference

WGA
Method :

encode(encoding, input)

On object WGA
Usage Encodes some text with a WebTML encoding
Description

This is the TMLScript pendant of WebTML attribute encode. You can use all encodings that are available to the current OpenWGA runtime and are also usable on the attribute.

For backward compatibility there still is a method "encode()" available on TMLContext whose use is discouraged since OpenWGA 5.3.

Parameters encoding (String): Name of the encoding, f.e. "html", "rtf"

input (String): The text to encode
Return value The encoded text (String)
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Examples Encoding plain text to HTML in TMLScript:

encodedText = WGA.encode("html", "This text is to be \n HTML-encoded !");


The encoding will convert the line feed to a HTML linebreak tag:

This text is to be <br> HTML-encoded !