Skip to main content

escapejs

Hex encode characters for use in JavaScript strings.

def escapejs(
value: Any
) - > SafeString

Hex encode characters for use in JavaScript strings.

Parameters

NameTypeDescription
valueAnyThe content to be escaped, which will be converted to a string before processing.

Returns

TypeDescription
SafeStringA string with characters hex-encoded for safe inclusion in JavaScript string literals, marked as safe for HTML output.