Enables scripted content fragments to encode data for rendering.
- HtmlAttributeEncode
- HtmlDecode
- HtmlEncode
- HtmlEnsureEncoded
- JavascriptEncode
- SanitizeHtml
- SearchEncode
- UriEscape
- UrlDecode
- UrlDecodeFileComponent
- UrlEncode
Methods
HtmlAttributeEncode
Encodes text for use within HTML or XML attributes
Velocity
#set($stringResponse = $core_v2_encoding.HtmlAttributeEncode($text))
JavaScript
var stringResponse = core_v2_encoding.HtmlAttributeEncode(text);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Raw text | Required |
Returns
String
HtmlDecode
HTML-decodes text
Velocity
#set($stringResponse = $core_v2_encoding.HtmlDecode($html))
JavaScript
var stringResponse = core_v2_encoding.HtmlDecode(html);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
html | String | HTML-encoded text | Required |
Returns
String
HtmlEncode
HTML-encodes text. Note, most text properties on data returned by the Platform API is already pre-encoded.
Velocity
#set($stringResponse = $core_v2_encoding.HtmlEncode($text))
JavaScript
var stringResponse = core_v2_encoding.HtmlEncode(text);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Raw text | Required |
Returns
String
HtmlEnsureEncoded
Ensures that text is HTML-encoded.
Velocity
#set($stringResponse = $core_v2_encoding.HtmlEnsureEncoded($text))
JavaScript
var stringResponse = core_v2_encoding.HtmlEnsureEncoded(text);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Raw text | Required |
Returns
String
JavascriptEncode
JavascriptEncode Overload 1
Escapes text for use within JavaScript string literals or JSON values
Velocity
#set($stringResponse = $core_v2_encoding.JavascriptEncode($text))
JavaScript
var stringResponse = core_v2_encoding.JavascriptEncode(text);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Raw text | Required |
JavascriptEncode Overload 2
Escapes dates into a format suitable for javascript parsing.
Velocity
#set($stringResponse = $core_v2_encoding.JavascriptEncode($date))
JavaScript
var stringResponse = core_v2_encoding.JavascriptEncode(date);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Source date | Required |
Returns
String
SanitizeHtml
SanitizeHtml Overload 1
Sanitizes an html string
Velocity
#set($stringResponse = $core_v2_encoding.SanitizeHtml($html))
JavaScript
var stringResponse = core_v2_encoding.SanitizeHtml(html);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
html | String | Html | Required |
SanitizeHtml Overload 2
Sanitizes an html string
Velocity
#set($stringResponse = $core_v2_encoding.SanitizeHtml($html, "%{ ApplicationId = $applicationIdArg, ApplicationTypeId = $applicationTypeIdArg, ContentTypeId = $contentTypeIdArg }"))
JavaScript
var stringResponse = core_v2_encoding.SanitizeHtml(html, { ApplicationId: applicationIdArg, ApplicationTypeId: applicationTypeIdArg, ContentTypeId: contentTypeIdArg });
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
html | String | Html | Required | ||
options | Options | Set of optional parameters including: | Required | ||
ApplicationId | Guid | Application ID in which this content exists. | Optional | ||
ApplicationTypeId | Guid | Application Type ID in which this content exists. | Optional | ||
ContentTypeId | Guid | Content Type ID of this content. | Optional |
Returns
String
SearchEncode
Velocity
#set($stringResponse = $core_v2_encoding.SearchEncode($text))
JavaScript
var stringResponse = core_v2_encoding.SearchEncode(text);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Text | Required |
Returns
String
UriEscape
Ensures a URI is escaped, excluding characters not reserved for URIs. Does not re-encode %.
Velocity
#set($stringResponse = $core_v2_encoding.UriEscape($uri))
JavaScript
var stringResponse = core_v2_encoding.UriEscape(uri);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
uri | String | Uri | Required |
Returns
String
UrlDecode
Decodes text that was URL encoded
Velocity
#set($stringResponse = $core_v2_encoding.UrlDecode($text))
JavaScript
var stringResponse = core_v2_encoding.UrlDecode(text);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Encoded text | Required |
Returns
String
UrlDecodeFileComponent
Velocity
#set($stringResponse = $core_v2_encoding.UrlDecodeFileComponent($urlToDecode))
JavaScript
var stringResponse = core_v2_encoding.UrlDecodeFileComponent(urlToDecode);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
urlToDecode | String | Url To Decode | Required |
Returns
String
UrlEncode
Encodes text for use within URL query parameters
Velocity
#set($stringResponse = $core_v2_encoding.UrlEncode($text))
JavaScript
var stringResponse = core_v2_encoding.UrlEncode(text);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
text | String | Raw text | Required |
Returns
String