OpenWGA 7.7 - TMLScript reference
WGAMethod :
encode(encoders, input [,context])
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. Just like on the attribute you can use a comma-separated list of multiple encoders that are processed in row. For backward compatibility there still is a method "encode()" available on TMLContext whose use is discouraged since OpenWGA 5.3. |
Parameters |
encoding (String): Comma-separated list of encoding names, f.e. "html", "rtf" input (String): The text to encode context (TMLContext, optional): TMLContext to be used for the encoder if supported by the encoder. |
Return value |
The encoded text (String) |
Allowed in script types |
|
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 ! |