$$HTML^DILF( ): HTML Encoder/Decoder

This function has two capabilities:

It encodes a string that may contain embedded "^" characters
according to the rules of HTML so that the "^" characters are replaced
with the string "&#94;". As a side effect, "&" characters are
encoded as the string "&amp;". Other encodings typical of HTML are not
performed by this function, since its focus is on encoding the "^"
character used as the delimiter in FileMan databases.

This function also decodes an encoded string, restoring its
"^" and "&" characters.

Format

$$HTML^DILF(STRING,ACTION)

Input Parameters

STRING

(Required) The string to be either encoded or decoded. Encoding a
string that contains no "^" or "&" characters has no effect on the string.
Nor does decoding one that lacks "^" and "&" substrings.

ACTION

(Optional) Set this parameter to 1 to encode the string, or -1 to
decode it. Defaults to 1.

Output

The function evaluates to the encoded or decoded string. If encoding the
string makes it overflow the string length limit, it returns error 207.
Decoding will never make it overflow.