GuardEncode()
Deprecated legacy function. Use context-specific functions (e.g., encodeForHTML) instead. Encodes data for a specific output context. This is a vital defense against Cross-Site Scripting (XSS) and injection attacks by ensuring characters are treated as data rather than executable code.
Status:
Requires Extension: Guard extension
GuardEncode( encodeFor=string, string=string, canonicalize=boolean, dialect=string );
Returns: String
| Argument | Description | Default |
|---|---|---|
|
encodeFor
string,
required
|
edit
The target output context. Valid values:
|
|
|
string
string,
required
|
edit
The raw string to be encoded. |
|
|
canonicalize
boolean,
optional
|
edit
If true, simplifies the input (resolving multiple/mixed encoding) before applying the new encoding. This prevents bypass attacks using double-encoding. Introduced: 5.0.0.0 |
false |
|
dialect
string,
optional
|
edit
Required only if encodeFor is 'sql'. Specifies the database syntax:
|
Examples
There are currently no examples for this function 29,577ms WARN No examples for function GuardEncodeSee also
- HTML
- JavaScript
- XML
- LDAP
- GuardDecode()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)