Code Type:
Code Scope of Action:
Code First Added:
Code Altered:
DEPRECATED - use ^value(escapeHTML())^. See ^value^, escapeHTML().
^encode( data )^
translates special character such as "<" and ">" contained in the data into entities before exporting them.
RSS and Atom syndication feeds with embedded mark-up tags — such as <b> or <p> — need to convert the tags into entities; <b> becomes &lt;b> .
Be aware that this code pre-dates Tinderbox's move to UTF-8 encoding of data output, lessening the need for as much escaping of characters. Also see the escapeHTML() action.
^encode recognises quotation marks. Single or double quotes that enclose the entire (data) string are stripped; otherwise, double quote marks are encoded.
Examples:
^encode(<b>)^
exports <b>
^encode(^text^)^
exports the text of the node to HTML and then encodes that text
^encode(^value($Author)^)^
encodes whatever is stored in the user attribute "Author"
^encode(Ångstrom)^
returns Ångstrom.