This version is out of date, covering development from v5.0.0 to v5.12.2. It is maintained here only for inbound reference links from elsewhere.

Jump to the current version of aTbRef.

Tinderbox Icon

^encode( data )^ (DEPRECATED)

This pages describes features, codes or syntax whose use is now DEPRECATED, i.e. not advised either for new or continued pre-existing use.

Deprecated aspects of Tinderbox may be supported on a legacy basis but the latter support can't be presumed to be indefinite. Therefore you should update your active TBX documents to latest practice as soon as practical.


Code Type: 

Code Scope of Action: 

Code First Added: 

Code Altered: 

 Export Mark-up   [other codes of this type]

 item   [codes with similar scope]

 Already in v5.0.0

 format"


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 &lt;b&gt; or &lt;p&gt; — need to convert the tags into entities; <b> becomes &amp;lt;b&gt; .

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 &lt;b&gt;

^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 &Aring;ngstrom.


Possible relevant notes (via "Similar Notes" feature):


A Tinderbox Reference File : Deprecated Usage : Deprecated Export Codes : ^encode( data )^ (DEPRECATED)