Tinderbox v10 Icon

attributeEncode(dataStr)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator in Current Baseline: 

Operator Last Altered: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Formatting  [other Formatting operators]

 v4.6.0

 Baseline

 As at baseline


attributeEncode(dataStr)

This function encodes all instances of the following in the argument string dataStr to numeric HTML entities . Thus:

For example, if the source dataStr is "this & that":

$MyString = attributeEncode("this & that") outputs "this & that".

An older export code equivalent was ^opmlEncode()^; the latter is deprecated in favour of the form ^value(attributeEncode(…))^.

XML export

As attributeEncode() encodes all the unsafe XML characters, this operator can be thought of as 'xmlEncode()', so can even be used to encode $Text.

For website XML sitemaps, e.g. for indexing/SEO purposes, that need to report page URLs in XML (as opposed to HTML) avoid ^path^ but instead use ^value(attributeEncode($HTMLExportPath))^.