Returns source as an Envision text literal, escaping special characters and
surrounding it with quotes.
source: text to escape.
Examples
table T = with
[| as Text |]
[| "" |]
[| "ABC" |]
[| "15\" Screen" |]
[| " Space " |]
T.Escaped = escape(T.Text)
show table "Escaped" with
T.Text
T.Escaped
This produces the following table:
Text
Escaped
""
ABC
“ABC”
15" Screen
“15" Screen”
Space
" Space "
Remarks
Characters outside the ASCII range are encoded as one or more \uXXXX escape
sequences.
The result of escape is still a text value, and is therefore limited to
256 UTF-8 bytes.
Errors
If the escaped representation would exceed 256 UTF-8 bytes, escape fails with
an error such as:
escape(): “…” escapes to more than 256 UTF-8 bytes.